Class: GatherContent::DSL::Option
- Inherits:
-
Object
- Object
- GatherContent::DSL::Option
- Defined in:
- lib/gather_content/dsl/option.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(choice) ⇒ Option
constructor
A new instance of Option.
- #label(label) ⇒ Object
- #name(name) ⇒ Object
- #selected(selected) ⇒ Object
Constructor Details
#initialize(choice) ⇒ Option
Returns a new instance of Option.
7 8 9 10 11 12 13 14 |
# File 'lib/gather_content/dsl/option.rb', line 7 def initialize(choice) @option = GatherContent::Config::Element::Option.new if choice..last.instance_of?(GatherContent::Config::Element::OtherOption) choice..insert(-2, @option) else choice. << @option end end |
Instance Method Details
#label(label) ⇒ Object
20 21 22 |
# File 'lib/gather_content/dsl/option.rb', line 20 def label(label) @option.label = label end |
#name(name) ⇒ Object
16 17 18 |
# File 'lib/gather_content/dsl/option.rb', line 16 def name(name) @option.name = name end |
#selected(selected) ⇒ Object
24 25 26 |
# File 'lib/gather_content/dsl/option.rb', line 24 def selected(selected) @option.selected = selected end |