Class: Ion::Options
- Inherits:
-
Object
- Object
- Ion::Options
- Defined in:
- lib/ion/options.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#index(type, name) ⇒ Object
Returns a certain index.
- #index_types ⇒ Object
-
#indices ⇒ Object
Returns all indices.
-
#initialize(model) ⇒ Options
constructor
A new instance of Options.
- #key ⇒ Object
- #search(&blk) ⇒ Object
Constructor Details
#initialize(model) ⇒ Options
Returns a new instance of Options.
4 5 6 7 |
# File 'lib/ion/options.rb', line 4 def initialize(model) @model = model @indices = Hash.new { |h, k| h[k] = Hash.new } end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
2 3 4 |
# File 'lib/ion/options.rb', line 2 def model @model end |
Instance Method Details
#index(type, name) ⇒ Object
Returns a certain index.
20 21 22 |
# File 'lib/ion/options.rb', line 20 def index(type, name) @indices[type][name] end |
#index_types ⇒ Object
29 30 31 |
# File 'lib/ion/options.rb', line 29 def index_types indices.map(&:class).uniq end |
#indices ⇒ Object
Returns all indices.
25 26 27 |
# File 'lib/ion/options.rb', line 25 def indices @indices.values.map(&:values).flatten end |