/r/ruby

Photograph via snooOG

Celebrate the weird and wonderful Ruby programming language with us!

A sub-Reddit for discussion and news about Ruby programming.

Learning Ruby?

Tools

Documentation

Books

Screencasts and Videos

News and updates

/r/ruby

86,337 Subscribers

12

Data vs Struct vs OpenStruct for complex JSON response

Hi fellow rubyists!

I currently consume a quite big JSON object (that has multiple levels) that I get via an OData2 response.

I initially looked at struct, but this means defining everything and values can be altered. So I decided to use Data instead since it cant be altered afterwards but here I now ended up having multiple Data objects for each level defining dozens of fields...

I know there is OpenStruct left, but this is deprecated and has a bad reputation somehow.

How would you work with an JSON based datasource that has >10 subobjects with > 100 fields that are quite stable (no field is going to get removed, only new ones may come) without the need to do too much work on duplicating everything. I still want to access the data like Object.subobject.data instead of json["Object"]["subobject"]["data"] since the paranthesis gets tedious over time

17 Comments
2024/11/14
10:08 UTC

0

Why you should get an outside review of your Ruby on Rails Application

By Kane Hooper

https://preview.redd.it/o4w8n082tq0e1.png?width=1000&format=png&auto=webp&s=671fba51667f351e131a422393311e8ab31382ee

You have invested a lot of money in your application, but do you have a complete understanding of the risks within your code?

If you were looking to buy a car, you want to be aware of any risks before you spend your hard-earned money. It is worth the investment to have a qualified mechanic inspect the engine.

It’s the same scenario before engaging in further development. Understanding your application’s risks will save you a lot of money and development time in the future.

Outsourcing for a fresh perspective on your application is not about distrusting your in-house development team or provider. It's about recognising their effort if they are doing an incredible job, as well as giving them an opportunity to learn and improve. The development world moves fast, so the key objective is to support and educate the existing development team. The more eyes on the code the better.

reinteractive’s Application Review is highly valuable if you are in any of the following situations:

  1. You have a Rails application with no or only a few developers working on it
  2. Development was completed by another software firm and you need to verify the quality of the app
  3. You are experiencing performance issues.
  4. You need to determine the risk profile of your investment.
  5. It is important to know if you have any security issues within your application.
  6. You want to develop new features and need a clear picture of your app as a base line.
  7. You want a sense of the technical debt within your application and what may be required to clean it up.

I am contacted by businesses for various reasons.

  • They want to upgrade their app with new features.
  • There are bugs within the app that aren’t resolving, and they need an expert opinion.
  • They want to bring in developers for a specific product development phase, bolstering their in-house team.

In every case, I advise first to get an App Review done on their existing application before anything further is done. It is the industry leading analysis service for Ruby on Rails applications.

Back to the analogy of treating your application as you would a car. You don’t just let your car run without regular inspections and services. In the same way, to keep your application running well and servicing your customers and business needs, you need it reviewed for quality, performance and security.

reinteractive is Australia's largest Ruby on Rails development firm. Lead by our Founder, Mikel Lindsaar, author of the Mail gem and the only Australian authorised to make changes to the Rails code base, we are a team of top Rails developers and designers. Over 2 million businesses around the world use software developed by reinteractive. We leverage this skill to deliver a top-quality app review. We dive in and review your code with a 9-point review service.

Technical debt is a real issue. Sometimes a developer, instead of using the best approach which will take longer, will choose the quick and easy solution when coding, especially when a deadline for launch is looming. It is totally understandable, and it may be needed to get your application up and running right now. But such a path also causes technical debt – similar to a financial debt. It costs money to rework it and the longer it is left, the more it can cost. If you want your application to be healthy for years to come, it is something that needs to be addressed as quickly as possible.

When we do an App Review, we provide you with a written summary with essential information around - security,
- performance,
- risk management
- and a summary of quality and
- technical debt within your application.
This lets you know exactly where everything stands. From there, you and your team can make the necessary choices based on facts. The last thing you want is to get into major feature development, hire a developer to do it, only to find the work becomes complicated because of technical debt already existing in your application.

And the good thing is an App Review is at an affordable price point making it a no-brainer essential service to check on your application.

I have already been helping clients with reviews of their applications. It gives them peace of mind knowing that major issues within their app have been identified and gives them a path forward to resolving them.

I am happy to talk, answer any question you have. Send me an email or give me a call AUS +61 2 8019 7252 | USA +1 415 745 3250.

0 Comments
2024/11/13
22:12 UTC

10

Transitioning to Ruby

Good Morning All!

I've been on a programming journey this year, learning Python as my first language and delving into AI Development with some fun little projects. I wanted to use it from SysAdmin tasks at my job, but I mostly use Bash and Powershell as our two systems are so separated there's no need for a universal tool.

Anyways, I'm now studying Ruby and I'm going through a course on Udemy. I feel like it'll be relatively easy to pick up once I understand the different syntax, and I wanna get the Ruby Silver cert for my own gratification.

When I learned python, I made a TON of projects. Everything from a subnet calculator to a full-blown AI with emotions, memory, reinforced learning, TTS/STT etc. I want to practice ruby in the same way, and my question is do y'all have any suggestions, and would it be a good idea to go back through my Python projects, and recreate them in Ruby?

Looking forward to this journey, though taking college classes, learning Ruby, and studying for my S+ is making my brain a little swamped lol. Thanks y'all!

3 Comments
2024/11/13
14:20 UTC

0

Ever Needed to Use Azure SDK in Ruby? Here’s the Solution You’ve Been Waiting For! 🔧

Hi All! We just published a guide on using Azure SDK with Ruby, even though it’s not officially supported. It’s a straightforward workaround if you’re looking to connect Azure with Ruby projects. Check it out and let us know what you think! link 🚀

1 Comment
2024/11/13
11:59 UTC

1

Unable to copy credentials to clipboard in Rails app - JavaScript clipboard API issues

Rails Version: 7.2.2
Ruby Version: 3.2.6
JavaScript: Using the Clipboard API to copy credentials to the clipboard.
Browser: Firefox.

Localhost***

Clipboard API usage:
This code "works", but it's not what i want it to do, i just want to copy the credentials to the clipboard (later when it works, i will be doing some changes). But it just works if i do it with an URL. 
I have a button in my app that, when clicked, generates a URL (just tested whatever website)  with the credentials and attempts to copy this URL to the clipboard. Here's the JavaScript I am using:
`
`document.querySelectorAll(".share-credentials-btn").forEach(function(button) {
  button.addEventListener("click", function() {
    const unlocked = button.getAttribute("data-unlocked") === 'true';
    if (unlocked) {
      const username = button.getAttribute("data-username");
      const password = button.getAttribute("data-password");

      // Generate the URL to share credentials
      const passwordPusherLink = `https://www.passwordstore.com/push?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`;
      
      // Try to copy the URL to the clipboard
      navigator.clipboard.writeText(passwordPusherLink).then(function() {
        alert("Credentials copied to clipboard!");
      }).catch(function(error) {
        alert("Error copying credentials: " + error);
      });

      // Optionally open the link in a new window
      window.open(passwordPusherLink, "_blank");
    } else {
      alert("Unlock the credentials to share them.");
    }
  });
});`
`
4 Comments
2024/11/13
11:14 UTC

9

tududi v0.32 - A Minimalist, Open-Source Task and Project Management Tool build with Sinatra (update)

0 Comments
2024/11/13
10:16 UTC

236

New level of interview hell

4th stage interview, 2nd coding challenge (first one was in js). Expected completion time: 4 hours, including cloud deployment. Build and style single page with a table of users and a form to add those users via Ajax. "Frontend" must be built with bootstrap and jQuery, none of which I have used in the past 10 years. No css preprocessors or js pipeline, no virtual/docker environment.

Is it just me, or is this getting absolutely riddiculus?

100 Comments
2024/11/13
08:13 UTC

18

A blog article about garbage collection in Ruby

I wrote this article about how the current garbage collection algorithm works in ruby. It would be great to get some feedback from the community on what they think about it :)

10 Comments
2024/11/12
13:12 UTC

11

A search engine for all your memes - built with Ruby on Rails

The open source engine indexes your memes by their visual content and text, making them easily searchable. Auto generate or manually create descriptions for your memes and tag them for easy recovery.

Find your funny fast, then drag & drop recovered meme(s) into any messager.

Note: local install requires >= 7gb of storage due to the size of AI model weights. It consists of three docker containers - the app, postgres db, and meme description generator.

Rails is a fantastic framework for building / iterating on "AI-powered" apps like this one.

See the project here 👉 https://github.com/neonwatty/meme_search

Uses gems like nieghbor, informers, and pgvector under the hood. As well as local calls to moondream, a "tiny" vision language model.

0 Comments
2024/11/12
13:07 UTC

1

Getting error trying to install ruby 3.2.2 on Mac with rvm

This is the error I get

"Error running '__rvm_make -j12',

please read /Users/prince/.rvm/log/1731408763_ruby-3.3.0/make.log

There has been an error while running make. Halting the installation."

This is the log⬇️⬇️⬇️

"+__rvm_make:0> make -j12

file2lastrev.rb: does not seem to be under a vcs: .

BASERUBY = /usr/bin/ruby --disable=gems

CC = gcc

LD = ld

LDSHARED = gcc -dynamiclib

CFLAGS = -O3 -I/usr/local/opt/libyaml/include -I/usr/local/opt/libksba/include -I/usr/local/opt/readline/include -I/usr/local/opt/zlib/include -I/usr/local/opt/openssl@3/include -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef  -fno-common -pipe 

XCFLAGS = -U\_FORTIFY\_SOURCE -D\_FORTIFY\_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY\_EXPORT -I. -I.ext/include/x86\_64-darwin24 -I./include -I. -I./prism -I./enc/unicode/15.0.0  

CPPFLAGS = -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE -D\_DARWIN\_UNLIMITED\_SELECT -D\_REENTRANT   

DLDFLAGS = -L/usr/local/opt/libyaml/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl@3/lib -Wl,-undefined,dynamic\_lookup -install\_name /Users/prince/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib -compatibility\_version 3.3 -current\_version 3.3.0  -fstack-protector-strong -framework CoreFoundation  -fstack-protector-strong -framework CoreFoundation  

SOLIBS = -lgmp -ldl -lobjc -lpthread 

LANG = 

LC\_ALL = 

LC\_CTYPE = UTF-8

MFLAGS = - --jobserver-fds=3,4 -j

RUSTC = no

YJIT\_RUSTC\_ARGS = --crate-name=yjit --crate-type=staticlib --edition=2021 -g -C lto=thin -C opt-level=3 -C overflow-checks=on '--out-dir=/Users/prince/.rvm/src/ruby-3.3.0/yjit/target/release/' ./yjit/src/lib.rs

Apple clang version 16.0.0 (clang-1600.0.26.4)

Target: x86_64-apple-darwin24.1.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

compiling ./main.c

compiling dmydln.c

compiling miniinit.c

compiling dmyext.c

translating probes probes.d

compiling ast.c

compiling bignum.c

compiling class.c

compiling compar.c

compiling compile.c

compiling complex.c

compiling cont.c

compiling debug.c

. ./vm_opts.h

compiling debug_counter.c

compiling dir.c

compiling dln_find.c

compiling encoding.c

compiling enum.c

compiling enumerator.c

compiling error.c

compiling eval.c

compiling file.c

compiling gc.c

compiling hash.c

compiling inits.c

compiling io.c

compiling io_buffer.c

compiling iseq.c

compiling load.c

compiling marshal.c

compiling math.c

compiling memory_view.c

compiling rjit.c

compiling rjit_c.c

compiling node.c

compiling node_dump.c

compiling numeric.c

compiling object.c

compiling pack.c

compiling parse.c

compiling parser_st.c

compiling proc.c

compiling process.c

compiling ractor.c

compiling random.c

compiling range.c

compiling rational.c

compiling re.c

compiling regcomp.c

compiling regenc.c

compiling regerror.c

compiling regexec.c

compiling regparse.c

compiling regsyntax.c

compiling ruby.c

compiling ruby_parser.c

compiling scheduler.c

compiling shape.c

compiling signal.c

compiling sprintf.c

compiling st.c

compiling strftime.c

compiling string.c

compiling struct.c

compiling symbol.c

compiling thread.c

compiling time.c

compiling transcode.c

compiling util.c

compiling variable.c

compiling vm.c

revision.h unchanged

compiling vm_backtrace.c

compiling vm_dump.c

compiling vm_sync.c

compiling vm_trace.c

compiling weakmap.c

compiling ./missing/explicit_bzero.c

compiling ./missing/setproctitle.c

compiling addr2line.c

compiling dmyenc.c

compiling dln.c

compiling localeinit.c

compiling array.c

compiling version.c

compiling prism/api_node.c

compiling prism/api_pack.c

/bin/sh ./tool/ifchange "--timestamp=.rbconfig.time" rbconfig.rb rbconfig.tmp

compiling prism/diagnostic.c

compiling prism/encoding.c

rbconfig.rb updated

compiling prism/extension.c

compiling prism/node.c

compiling prism/options.c

compiling prism/pack.c

compiling prism/prettyprint.c

compiling prism/regexp.c

compiling prism/serialize.c

compiling prism/token_type.c

compiling prism/util/pm_buffer.c

compiling prism/util/pm_char.c

compiling prism/util/pm_constant_pool.c

compiling prism/util/pm_list.c

compiling prism/util/pm_memchr.c

compiling prism/util/pm_newline_list.c

compiling prism/util/pm_state_stack.c

compiling prism/util/pm_string.c

compiling prism/util/pm_string_list.c

compiling prism/util/pm_strncasecmp.c

compiling prism/util/pm_strpbrk.c

compiling prism/prism.c

compiling prism_init.c

assembling coroutine/amd64/Context.S

compiling enc/ascii.c

compiling enc/us_ascii.c

compiling enc/unicode.c

compiling enc/utf_8.c

compiling enc/trans/newline.c

generating encdb.h

generating x86_64-darwin24-fake.rb

creating verconf.h

verconf.h updated

encdb.h updated

compiling loadpath.c

x86_64-darwin24-fake.rb updated

generating enc.mk

making srcs under enc

make[1]: Nothing to be done for `srcs'.

generating transdb.h

transdb.h updated

linking miniruby

builtin_binary.inc updated

2390a73dbefe57c9a2c2fe28337b45f2bdac63026d0fd4a288ece3c743d87a96 builtin_binary.inc

compiling builtin.c

linking static-library libruby.3.3-static.a

linking shared-library libruby.3.3.dylib

generating makefiles ext/configure-ext.mk

building spec/ruby/optional/capi/ext/array_spec.bundle

building spec/ruby/optional/capi/ext/basic_object_spec.bundle

building spec/ruby/optional/capi/ext/bignum_spec.bundle

building spec/ruby/optional/capi/ext/binding_spec.bundle

building spec/ruby/optional/capi/ext/boolean_spec.bundle

building spec/ruby/optional/capi/ext/class_id_under_autoload_spec.bundle

building spec/ruby/optional/capi/ext/class_spec.bundle

building spec/ruby/optional/capi/ext/class_under_autoload_spec.bundle

building spec/ruby/optional/capi/ext/complex_spec.bundle

building spec/ruby/optional/capi/ext/constants_spec.bundle

building spec/ruby/optional/capi/ext/data_spec.bundle

ext/configure-ext.mk updated

building spec/ruby/optional/capi/ext/debug_spec.bundle

building spec/ruby/optional/capi/ext/encoding_spec.bundle

building spec/ruby/optional/capi/ext/enumerator_spec.bundle

building spec/ruby/optional/capi/ext/exception_spec.bundle

building spec/ruby/optional/capi/ext/fiber_spec.bundle

building spec/ruby/optional/capi/ext/file_spec.bundle

building spec/ruby/optional/capi/ext/fixnum_spec.bundle

building spec/ruby/optional/capi/ext/float_spec.bundle

building spec/ruby/optional/capi/ext/gc_spec.bundle

building spec/ruby/optional/capi/ext/globals_spec.bundle

building spec/ruby/optional/capi/ext/hash_spec.bundle

building spec/ruby/optional/capi/ext/integer_spec.bundle

building spec/ruby/optional/capi/ext/io_spec.bundle

building spec/ruby/optional/capi/ext/kernel_spec.bundle

building spec/ruby/optional/capi/ext/language_spec.bundle

building spec/ruby/optional/capi/ext/marshal_spec.bundle

building spec/ruby/optional/capi/ext/module_spec.bundle

building spec/ruby/optional/capi/ext/module_under_autoload_spec.bundle

building spec/ruby/optional/capi/ext/mutex_spec.bundle

building spec/ruby/optional/capi/ext/numeric_spec.bundle

building spec/ruby/optional/capi/ext/object_spec.bundle

building spec/ruby/optional/capi/ext/proc_spec.bundle

building spec/ruby/optional/capi/ext/range_spec.bundle

building spec/ruby/optional/capi/ext/rational_spec.bundle

building spec/ruby/optional/capi/ext/rbasic_spec.bundle

building spec/ruby/optional/capi/ext/regexp_spec.bundle

building spec/ruby/optional/capi/ext/st_spec.bundle

building spec/ruby/optional/capi/ext/string_spec.bundle

building spec/ruby/optional/capi/ext/struct_spec.bundle

building spec/ruby/optional/capi/ext/symbol_spec.bundle

building spec/ruby/optional/capi/ext/thread_spec.bundle

building spec/ruby/optional/capi/ext/time_spec.bundle

building spec/ruby/optional/capi/ext/tracepoint_spec.bundle

building spec/ruby/optional/capi/ext/typed_data_spec.bundle

building spec/ruby/optional/capi/ext/util_spec.bundle

making enc

making trans

compiling ./enc/encdb.c

compiling ./enc/trans/transdb.c

configuring bigdecimal

configuring -test-/RUBY_ALIGNOF

configuring cgi/escape

configuring continuation

configuring coverage

configuring date

configuring digest

configuring erb/escape

configuring digest/bubblebabble

configuring digest/md5

configuring etc

configuring fcntl

compiling ./enc/trans/big5.c

compiling ./enc/big5.c

compiling ./enc/trans/cesu_8.c

configuring fiddle

configuring io/console

configuring json

configuring json/generator

configuring json/parser

configuring monitor

compiling ./enc/cesu_8.c

configuring -test-/abi

configuring -test-/arith_seq/beg_len_step

configuring -test-/arith_seq/extract

configuring -test-/array/concat

configuring -test-/array/resize

configuring -test-/bignum

configuring -test-/bug-14834

configuring -test-/bug-3571

configuring -test-/bug-5832

configuring -test-/bug_reporter

configuring -test-/class

configuring -test-/cxxanyargs

compiling ./enc/trans/chinese.c

configuring nkf

compiling ./enc/cp949.c

compiling ./enc/trans/ebcdic.c

configuring -test-/debug

configuring -test-/dln/empty

configuring -test-/econv

configuring -test-/enumerator_kw

configuring -test-/eval

configuring -test-/exception

configuring -test-/fatal

configuring -test-/file

compiling ./enc/emacs_mule.c

configuring digest/rmd160

configuring objspace

compiling ./enc/trans/emoji.c

compiling ./enc/euc_jp.c

configuring digest/sha1

compiling ./enc/euc_kr.c

configuring openssl

compiling ./enc/euc_tw.c

libffi_version: 3.4.0

configuring pathname

configuring digest/sha2

compiling ./enc/gb2312.c

compiling ./enc/gb18030.c

compiling ./enc/trans/emoji_iso2022_kddi.c

compiling ./enc/gbk.c

compiling ./enc/iso_8859_1.c

compiling ./enc/trans/emoji_sjis_docomo.c

compiling ./enc/iso_8859_2.c

compiling ./enc/trans/emoji_sjis_kddi.c

compiling ./enc/iso_8859_3.c

configuring psych

compiling ./enc/iso_8859_4.c

compiling ./enc/iso_8859_5.c

configuring -test-/float

configuring -test-/funcall

configuring -test-/gvl/call_without_gvl

configuring -test-/hash

configuring -test-/integer

configuring -test-/iseq_load

configuring -test-/iter

configuring -test-/load/dot.dot

configuring -test-/load/protect

configuring -test-/load/resolve_symbol_resolver

configuring -test-/load/resolve_symbol_target

configuring -test-/load/stringify_symbols

configuring -test-/load/stringify_target

configuring -test-/marshal/compat

configuring -test-/marshal/internal_ivar

configuring -test-/marshal/usr

configuring -test-/memory_status

configuring -test-/memory_view

configuring -test-/method

configuring -test-/notimplement

configuring pty

configuring -test-/num2int

configuring -test-/path_to_class

configuring -test-/popen_deadlock

configuring -test-/postponed_job

configuring -test-/printf

configuring -test-/proc

configuring -test-/random

configuring -test-/rational

configuring -test-/rb_call_super_kw

configuring -test-/recursion

configuring -test-/regexp

configuring -test-/scan_args

configuring -test-/st/foreach

configuring -test-/st/numhash

configuring -test-/st/update

configuring -test-/string

configuring -test-/struct

configuring -test-/symbol

compiling ./enc/iso_8859_6.c

compiling ./enc/trans/emoji_sjis_softbank.c

compiling ./enc/iso_8859_7.c

configuring rbconfig/sizeof

compiling ./enc/iso_8859_8.c

configuring -test-/thread/instrumentation

configuring -test-/thread_fd

configuring -test-/time

configuring -test-/tracepoint

configuring -test-/typeddata

configuring -test-/vm

configuring -test-/wait

compiling ./enc/trans/escape.c

compiling ./enc/iso_8859_9.c

compiling ./enc/trans/gb18030.c

configuring ripper

compiling ./enc/iso_8859_10.c

compiling ./enc/trans/gbk.c

compiling ./enc/iso_8859_11.c

compiling ./enc/trans/iso2022.c

compiling ./enc/iso_8859_13.c

configuring rubyvm

compiling ./enc/trans/japanese.c

configuring socket

compiling ./enc/iso_8859_14.c

compiling ./enc/iso_8859_15.c

configuring stringio

configuring strscan

compiling ./enc/trans/japanese_euc.c

compiling ./enc/iso_8859_16.c

compiling ./enc/trans/japanese_sjis.c

compiling ./enc/koi8_r.c

compiling ./enc/trans/korean.c

compiling ./enc/koi8_u.c

compiling ./enc/trans/single_byte.c

compiling ./enc/shift_jis.c

compiling ./enc/utf_16be.c

configuring syslog

compiling ./enc/trans/utf8_mac.c

compiling ./enc/utf_16le.c

compiling ./enc/utf_32be.c

compiling ./enc/utf_32le.c

compiling ./enc/windows_31j.c

configuring zlib

compiling ./enc/windows_1250.c

configuring debug-1.9.1/ext/debug

compiling ./enc/trans/utf_16_32.c

compiling ./enc/windows_1251.c

configuring racc-1.7.3/ext/racc/cparse

compiling ./enc/windows_1252.c

linking transcoder transdb.bundle

linking transcoder big5.bundle

linking transcoder cesu_8.bundle

compiling ./enc/windows_1253.c

linking transcoder chinese.bundle

linking transcoder ebcdic.bundle

configuring rbs-3.4.0/ext/rbs_extension

compiling ./enc/windows_1254.c

linking transcoder emoji.bundle

compiling ./enc/windows_1257.c

linking transcoder emoji_iso2022_kddi.bundle

linking encoding encdb.bundle

linking encoding big5.bundle

linking transcoder emoji_sjis_docomo.bundle

linking transcoder emoji_sjis_kddi.bundle

linking encoding cesu_8.bundle

linking encoding cp949.bundle

linking transcoder emoji_sjis_softbank.bundle

linking encoding emacs_mule.bundle

linking transcoder escape.bundle

linking transcoder gb18030.bundle

linking transcoder gbk.bundle

linking encoding euc_jp.bundle

linking transcoder iso2022.bundle

linking transcoder japanese.bundle

linking encoding euc_kr.bundle

linking transcoder japanese_euc.bundle

linking encoding euc_tw.bundle

linking encoding gb2312.bundle

linking transcoder japanese_sjis.bundle

linking encoding gb18030.bundle

linking transcoder korean.bundle

linking transcoder single_byte.bundle

linking encoding gbk.bundle

linking transcoder utf8_mac.bundle

linking encoding iso_8859_1.bundle

linking transcoder utf_16_32.bundle

linking encoding iso_8859_2.bundle

linking encoding iso_8859_3.bundle

linking encoding iso_8859_4.bundle

linking encoding iso_8859_5.bundle

linking encoding iso_8859_6.bundle

linking encoding iso_8859_7.bundle

linking encoding iso_8859_8.bundle

linking encoding iso_8859_9.bundle

linking encoding iso_8859_10.bundle

linking encoding iso_8859_11.bundle

linking encoding iso_8859_13.bundle

linking encoding iso_8859_14.bundle

linking encoding iso_8859_15.bundle

linking encoding iso_8859_16.bundle

linking encoding koi8_r.bundle

linking encoding koi8_u.bundle

linking encoding shift_jis.bundle

linking encoding utf_16be.bundle

linking encoding utf_16le.bundle

linking encoding utf_32be.bundle

linking encoding utf_32le.bundle

linking encoding windows_31j.bundle

linking encoding windows_1250.bundle

linking encoding windows_1251.bundle

linking encoding windows_1252.bundle

linking encoding windows_1253.bundle

linking encoding windows_1254.bundle

linking encoding windows_1257.bundle

making encs

make[1]: Nothing to be done for `encs'.

configuring io/nonblock

configuring io/wait

generating makefile exts.mk

exts.mk updated

compiling bug-14384.c

compiling c.c

compiling to_ary_concat.c

compiling beg_len_step.c

compiling bug_reporter.c

compiling bug.c

compiling compiling bug.c

resize.c

compiling extract.c

compiling class2name.c

compiling compiling big2str.c

cxxanyargs.cpp

compiling cpp.cpp

compiling init.c

linking shared-object -test-/array/to_ary_concat.bundle

linking shared-object -test-/bug_reporter.bundle

linking shared-object -test-/array/resize.bundle

linking shared-object -test-/bug_14834.bundle

linking shared-object -test-/bug_5832.bundle

linking shared-object -test-/arith_seq/extract.bundle

compiling bigzero.c

linking shared-object -test-/bug_3571.bundle

linking shared-object -test-/arith_seq/beg_len_step.bundle

compiling div.c

compiling init.c

compiling append.c

compiling init.c

compiling empty.c

compiling intpack.c

compiling enumerator_kw.c

linking shared-object -test-/class.bundle

compiling mul.c

linking shared-object -test-/RUBY_ALIGNOF.bundle

compiling init.c

compiling inspector.c

compiling str2big.c

compiling profile_frames.c

compiling eval.c

linking shared-object -test-/dln/empty.bundle

linking shared-object -test-/enumerator_kw.bundle

compiling dataerror.c

compiling rb_fatal.c

compiling fs.c

compiling init.c

linking shared-object -test-/cxxanyargs.bundle

compiling init.c

linking shared-object -test-/econv.bundle

compiling enc_raise.c

compiling stat.c

linking shared-object -test-/eval.bundle

linking shared-object -test-/bignum.bundle

linking shared-object -test-/debug.bundle

compiling ensured.c

compiling init.c

linking shared-object -test-/fatal/rb_fatal.bundle

compiling nextafter.c

compiling funcall.c

compiling call_without_gvl.c

compiling delete.c

compiling core_ext.c

compiling iseq_load.c

compiling break.c

compiling dot.dot.c

linking shared-object -test-/file.bundle

compiling protect.c

linking shared-object -test-/exception.bundle

compiling init.c

linking shared-object -test-/float.bundle

linking linking shared-object shared-object -test-/funcall.bundle

-test-/gvl/call_without_gvl.bundle

compiling init.c

compiling init.c

compiling my_integer.c

linking shared-object -test-/iseq_load.bundle

compiling yield.c

linking shared-object -test-/load/dot.dot.bundle

compiling resolve_symbol_resolver.c

compiling resolve_symbol_target.c

compiling stringify_symbols.c

linking shared-object -test-/load/protect.bundle

compiling stringify_target.c

linking shared-object -test-/hash.bundle

compiling usrcompat.c

compiling internal_ivar.c

compiling usrmarshal.c

compiling memory_status.c

linking shared-object -test-/iter.bundle

compiling memory_view.c

compiling arity.c

linking shared-object -test-/load/resolve_symbol_target.bundle

linking shared-object -test-/load/stringify_symbols.bundle

linking shared-object -test-/load/resolve_symbol_resolver.bundle

linking shared-object -test-/load/stringify_target.bundle

linking shared-object -test-/integer.bundle

linking shared-object -test-/marshal/compat.bundle

linking shared-object -test-/marshal/internal_ivar.bundle

linking shared-object -test-/marshal/usr.bundle

compiling bug.c

compiling init.c

compiling num2int.c

linking shared-object -test-/memory_status.bundle

compiling path_to_class.c

compiling postponed_job.c

compiling printf.c

compiling init.c

compiling bad_version.c

compiling rat.c

compiling rb_call_super_kw.c

compiling recursion.c

linking shared-object -test-/notimplement.bundle

linking shared-object -test-/method.bundle

linking shared-object -test-/path_to_class.bundle

linking shared-object -test-/memory_view.bundle

linking shared-object -test-/num2int.bundle

linking shared-object -test-/postponed_job.bundle

compiling receiver.c

linking shared-object -test-/rb_call_super_kw.bundle

linking shared-object -test-/printf.bundle

compiling init.c

compiling super.c

compiling loop.c

linking shared-object -test-/recursion.bundle

compiling init.c

compiling parse_depth_limit.c

compiling scan_args.c

compiling foreach.c

compiling numhash.c

compiling update.c

compiling capacity.c

compiling data.c

compiling init.c

linking shared-object -test-/proc.bundle

linking shared-object -test-/random.bundle

linking shared-object -test-/regexp.bundle

compiling instrumentation.c

linking shared-object -test-/rational.bundle

linking shared-object -test-/st/update.bundle

compiling type.c

linking shared-object -test-/st/foreach.bundle

linking shared-object -test-/st/numhash.bundle

compiling duplicate.c

compiling thread_fd.c

compiling coderange.c

compiling init.c

compiling gc_hook.c

compiling init.c

compiling cstr.c

compiling len.c

compiling ellipsize.c

linking shared-object -test-/thread/instrumentation.bundle

linking shared-object -test-/symbol.bundle

linking shared-object -test-/thread_fd.bundle

compiling typeddata.c

compiling tracepoint.c

compiling leap_second.c

linking shared-object -test-/scan_args.bundle

compiling member.c

compiling enc_associate.c

compiling new.c

compiling enc_dummy.c

compiling at_exit.c

compiling enc_str_buf_cat.c

compiling wait.c

compiling fstring.c

linking shared-object -test-/typeddata.bundle

compiling bigdecimal.c

linking shared-object -test-/tracepoint.bundle

linking shared-object -test-/struct.bundle

compiling init.c

compiling modify.c

linking shared-object -test-/vm/at_exit.bundle

compiling escape.c

linking shared-object -test-/wait.bundle

compiling new.c

compiling nofree.c

compiling continuation.c

compiling coverage.c

compiling missing.c

compiling normalize.c

compiling qsort.c

compiling rb_interned_str.c

linking shared-object -test-/time.bundle

compiling rb_str_dup.c

linking shared-object continuation.bundle

compiling date_core.c

installing default coverage libraries

compiling date_parse.c

linking shared-object cgi/escape.bundle

compiling digest.c

compiling date_strftime.c

installing default bigdecimal libraries

compiling set_len.c

compiling escape.c

linking shared-object coverage.bundle

compiling date_strptime.c

compiling etc.c

installing default date_core libraries

compiling fcntl.c

compiling closure.c

linking shared-object -test-/string.bundle

linking shared-object erb/escape.bundle

linking shared-object fcntl.bundle

linking shared-object digest.bundle

compiling conversions.c

installing digest libraries

compiling fiddle.c

linking shared-object etc.bundle

compiling console.c

compiling function.c

compiling nonblock.c

installing default digest libraries

compiling handle.c

compiling memory_view.c

compiling wait.c

compiling pinned.c

compiling pointer.c

installing default console libraries

linking shared-object io/nonblock.bundle

linking shared-object io/wait.bundle

compiling monitor.c

compiling nkf.c

compiling object_tracing.c

linking shared-object io/console.bundle

compiling pathname.c

compiling openssl_missing.c

installing default fiddle libraries

compiling psych.c

compiling pty.c

installing default monitor libraries

installing default nkf libraries

compiling sizes.c

installing default pathname libraries

linking shared-object monitor.bundle

compiling eventids1.c

linking shared-object fiddle.bundle

compiling ossl.c

compiling objspace.c

compiling psych_emitter.c

ld: warning: ignoring duplicate libraries: '-lffi'

compiling objspace_dump.c

compiling ossl_asn1.c

installing default pty libraries

compiling limits.c

linking shared-object pty.bundle

compiling eventids2.c

compiling psych_parser.c

linking shared-object pathname.bundle

compiling ossl_bio.c

linking shared-object rbconfig/sizeof.bundle

compiling ripper.c

compiling ossl_bn.c

installing default libraries

compiling ripper_init.c

compiling ossl_cipher.c

installing default objspace libraries

compiling init.c

linking shared-object objspace.bundle

linking shared-object bigdecimal.bundle

compiling psych_to_ruby.c

compiling constants.c

compiling psych_yaml_tree.c

compiling stringio.c

compiling basicsocket.c

checking ../.././parse.y and ../.././ext/ripper/eventids2.c

compiling socket.c

compiling ossl_config.c

compiling strscan.c

installing default ripper libraries

compiling ipsocket.c

compiling syslog.c

compiling ossl_digest.c

compiling zlib.c

linking shared-object date_core.bundle

linking shared-object psych.bundle

compiling ossl_engine.c

linking shared-object strscan.bundle

installing default syslog libraries

compiling tcpsocket.c

linking shared-object stringio.bundle

linking shared-object syslog.bundle

ld: warning: ignoring duplicate libraries: '-lyaml'

compiling debug.c

linking shared-object nkf.bundle

compiling ossl_hmac.c

compiling tcpserver.c

compiling ossl_kdf.c

compiling cparse.c

compiling constants.c

compiling bubblebabble.c

compiling sockssocket.c

compiling ossl_ns_spki.c

compiling iseq_collector.c

ossl_hmac.c:249:35: error: incomplete definition of type 'struct evp_md_ctx_st'

249 | pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_get_pkey_ctx(ctx));

| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

./openssl_missing.h:230:41: note: expanded from macro 'EVP_MD_CTX_get_pkey_ctx'

230 | # define EVP_MD_CTX_get_pkey_ctx(x) (x)->pctx

| ~~~^

/usr/local/include/openssl/ossl_typ.h:92:16: note: forward declaration of 'struct evp_md_ctx_st'

92 | typedef struct evp_md_ctx_st EVP_MD_CTX;

| ^

1 error generated.

make[2]: *** [ossl_hmac.o] Error 1

make[2]: *** Waiting for unfinished jobs....

compiling md5init.c

compiling lexer.c

compiling lexstate.c

linking shared-object digest/bubblebabble.bundle

compiling udpsocket.c

compiling rmd160init.c

linking shared-object racc/cparse.bundle

linking shared-object debug/debug.bundle

compiling unixsocket.c

compiling location.c

make[1]: *** [ext/openssl/all] Error 2

make[1]: *** Waiting for unfinished jobs....

linking shared-object digest/md5.bundle

compiling rmd160.c

compiling unixserver.c

compiling main.c

compiling option.c

compiling parser.c

compiling parserstate.c

compiling ancdata.c

compiling ruby_objs.c

compiling raddrinfo.c

compiling ifaddr.c

compiling unescape.c

installing default socket libraries

linking shared-object digest/rmd160.bundle

linking shared-object zlib.bundle

linking shared-object rbs_extension.bundle

linking shared-object socket.bundle

linking shared-object ripper.bundle

make: *** [build-ext] Error 2

+__rvm_make:0> return 2

"

Please help fix it

8 Comments
2024/11/12
11:03 UTC

19

Weird Ruby operators and special character syntax?

What are the weirdest and most obscure operators and special character syntax features in the Ruby programming language? Gimme your worst. I know there are a lot of dusty corners in Ruby.

For example, someone just told me about the string freeze/unfreeze modifiers (still not sure what to make of them):

> three = -"3"
=> "3"
> three.frozen?
=> true

> one = "1"
=> "1"
> one.frozen?
=> false
> one.freeze
=> "1"
> one.frozen?
=> true
> two = +one
=> "1"
> one.frozen?
=> true
> two.frozen?
=> false
> one.object_id
=> 360
> two.object_id
=> 380

Another favorite is Percent Notation because you can end up with some wacky statements:

> %=Jurassic Park=
=> "Jurassic Park"
> % Ghostbusters 
=> "Ghostbusters"
> %=what===%?what?
=> true
19 Comments
2024/11/11
22:18 UTC

3

Rocky Mountain Ruby 2024 Playlist

0 Comments
2024/11/11
16:20 UTC

17

I'm getting terrible benchmark speeds for Ruby 3. Anyone have tips?

I've upgraded my Rails apps from using Ruby 2.6 to Ruby 3.3.5. I use DigitalOcean droplets, compiling Ruby from source - but my web app was crawling.

So I ran benchmarks on Ruby itself. I keep getting dismal results with Ruby 3.3.5 vs my old Ruby 2.6.10 server when benchmarking Ruby itself.

RUBY 2.6.10

Warming up --------------------------------------
            for loop     1.805k i/100ms
           each loop     2.083k i/100ms
           map + sum     1.370k i/100ms
              inject     2.110k i/100ms
              reduce     2.139k i/100ms
string concatenation   106.000 i/100ms
string interpolation    99.000 i/100ms
         string join   761.000 i/100ms
        string slice    50.821k i/100ms
       string upcase    11.316k i/100ms
      string reverse    21.923k i/100ms
...

RUBY 3.2.6

Warming up --------------------------------------
            for loop   829.000 i/100ms
           each loop   885.000 i/100ms
           map + sum   748.000 i/100ms
              inject     1.017k i/100ms
              reduce   779.000 i/100ms
string concatenation    71.000 i/100ms
string interpolation    66.000 i/100ms
         string join   483.000 i/100ms
        string slice    20.317k i/100ms
       string upcase     6.240k i/100ms
      string reverse     7.921k i/100ms

RUBY 3.3.5

Warming up --------------------------------------
            for loop   565.000 i/100ms
           each loop   817.000 i/100ms
           map + sum   445.000 i/100ms
              inject   760.000 i/100ms
              reduce   688.000 i/100ms
string concatenation    55.000 i/100ms
string interpolation    48.000 i/100ms
         string join   374.000 i/100ms
        string slice    21.811k i/100ms
       string upcase    10.103k i/100ms
      string reverse    12.494k i/100ms

Ruby 3.2.6 is about 2.5x slower and 3.3.5 is about 3x slower.

I have tried spinning up many servers (DigitalOcean droplets), with jemalloc, without jemalloc, and I cannot get decent numbers for Ruby 3.

Any insight here?

24 Comments
2024/11/11
15:49 UTC

31

Rocky Mountain Ruby 2024: DragonRuby Game Toolkit Lessons Learned (16 minute presentation, followed by some code exploration and QnA)

1 Comment
2024/11/11
11:58 UTC

14

Terminal text only UI apps

Hi,

Can someone suggest a resource to learn to build terminal UI for a Ruby app? Usually I use Hanami or Roda for web apps, I used to code with Shoes for desktops, but I'd really like to create a terminal app as well that would still be appealing even though being old school.🙂

3 Comments
2024/11/10
07:51 UTC

Back To Top