Thursday, 15 May 2014

module - Ruby - ARGV.empty? ModuleName else code here end always returns ModuleName -



module - Ruby - ARGV.empty? ModuleName else code here end always returns ModuleName -

probably stupid question

i have code:

if argv.empty? modulename else #awesome code here end

but no matter what, modulename module evaluated. there missing?

i think module evaluated when require it, not because modulename line reached.

example:

in foo.rb file:

class foo puts "foo" end

and in irb:

1.8.7 :001 > require 'foo' foo => true

ruby module argv

No comments:

Post a Comment