Flowdock
method

parse

Importance_2
v2_6_3 - Show latest stable - 0 notes - Class: Option
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
parse(key, value) public

This parse quick options given as method_options. It makes several assumptions, but you can be more specific using the option method.

parse :foo => "bar"
#=> Option foo with default value bar

parse [:foo, :baz] => "bar"
#=> Option foo with default value bar and alias :baz

parse :foo => :required
#=> Required option foo without default value

parse :foo => 2
#=> Option foo with default value 2 and type numeric

parse :foo => :numeric
#=> Option foo without default value and type numeric

parse :foo => true
#=> Option foo with default value true and type boolean

The valid types are :boolean, :numeric, :hash, :array and :string. If none is given a default type is assumed. This default type accepts arguments as string (–foo=value) or booleans (just –foo).

By default all options are optional, unless :required is given.

Show source
Register or log in to add new notes.