Category: ruby

  • Handling keyword arguments in method_missing in Ruby

    If you implement a method_missing method to receive methods that receive keyword arguments and you only receive and forward (to send) the method name, *args, and &block, you will receive ArgumentError: wrong number of arguments (given 3, expected 2) when the arguments are forwarded. This is because the keyword arguments will revert to the backward-compatible…

  • Quick script to dump info about OpenSSL in ruby

    Ruby can be built with OpenSSL by default or built with an alternate OpenSSL library (for example, if you had Ruby 3.0 and wanted an OpenSSL >= 3.0.0). There are a few constants and methods to check the version and capabilities of you OpenSSL library connected to Ruby, all from the module OpenSSL documentation available…

  • Controlling your rake spec run

    rake spec SPEC=path/to/file/from/project/root_spec.rb rake spec SPEC_OPTS=”–format documentation”