Re: Ruby idiom equivalent to Perl "$asdf = $ARGV|| die 'arg required'"?]

Something like this, perhaps?

a = ARGV[0] || fail('arg required')

cjs

2007/12/4, Curt S. [email protected]:

Something like this, perhaps?

a = ARGV[0] || fail('arg required')

Here’s some more

a = ARGV.shift or raise “arg required”
a = ARGV.shift or raise ArgumentError, “arg required”

For more complex cmd line parsing I’d use OptionParser.

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs