I recently converted a ruby library to a gem, which seemed to break the command line usability
Worked fine as a library
$ ruby -r foobar -e 'p FooBar.question' # => "answer"
And as a gem, irb knows how to require a gem from command-line switches
$ irb -rubygems -r foobar
irb(main):001:0> FooBar.question # => "answer"
But the same fails for ruby itself:
$ ruby -rubygems -r foobar -e 'p FooBar.question'
ruby: no such file to load -- foobar (LoadError)
must I now do this, which seems ugly:
ruby -rubygems -e 'require "foobar"; p FooBar.question' # => "answer"
Or is there a way to make the 2 switches work?
Note: I know the gem could add a bin/program for every useful method but I don't like to pollute the command line namespace unnecessarily