Class: GatherContent::Config::Element::OtherOption

Inherits:
Option
  • Object
show all
Defined in:
lib/gather_content/config/elements/other_option.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Option

#to_json

Constructor Details

#initialize(name = nil, label = nil, selected = nil, value = nil) ⇒ OtherOption

Returns a new instance of OtherOption.



9
10
11
12
# File 'lib/gather_content/config/elements/other_option.rb', line 9

def initialize(name = nil, label = nil, selected = nil, value = nil)
  super(name, label, selected)
  @value = value
end

Instance Attribute Details

#labelObject

Returns the value of attribute label.



7
8
9
# File 'lib/gather_content/config/elements/other_option.rb', line 7

def label
  @label
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/gather_content/config/elements/other_option.rb', line 7

def name
  @name
end

#selectedObject

Returns the value of attribute selected.



7
8
9
# File 'lib/gather_content/config/elements/other_option.rb', line 7

def selected
  @selected
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/gather_content/config/elements/other_option.rb', line 7

def value
  @value
end

Instance Method Details

#serialize(options = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/gather_content/config/elements/other_option.rb', line 14

def serialize(options = nil)
  base = super(options)

  value = !!selected ? self.value : ""

  base.merge({
    value: value
  })
end