Class: GatherContent::DSL::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/gather_content/dsl/option.rb

Direct Known Subclasses

OtherOption

Instance Method Summary collapse

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.options.last.instance_of?(GatherContent::Config::Element::OtherOption)
    choice.options.insert(-2, @option)
  else
    choice.options << @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