Class: GLI::Options
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- GLI::Options
- Defined in:
- lib/gli/options.rb
Overview
Subclass of OpenStruct
that provides hash-like methods for #[] and #[]=. Note that is is not a Hash. By using GLI::App#use_openstruct, your options will be coerced into one of these.
Instance Method Summary collapse
-
#[](k) ⇒ Object
Return the value of an attribute.
-
#[]=(k, v) ⇒ Object
Set the value of an attribute.
- #map(&block) ⇒ Object
Instance Method Details
#[](k) ⇒ Object
Return the value of an attribute
9 10 11 |
# File 'lib/gli/options.rb', line 9 def[](k) self.send(k.to_sym) end |
#[]=(k, v) ⇒ Object
Set the value of an attribute
14 15 16 |
# File 'lib/gli/options.rb', line 14 def[]=(k, v) self.send("#{k.to_sym}=",v) end |
#map(&block) ⇒ Object
18 19 20 |
# File 'lib/gli/options.rb', line 18 def map(&block) @table.map(&block) end |