Class: Rubytypeformio::ChoiceField
- Defined in:
- lib/rubytypeformio/choice_field.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#choices ⇒ Object
Returns the value of attribute choices.
Attributes inherited from Field
#description, #id, #question, #required, #type
Instance Method Summary collapse
-
#initialize(question, description, required, type, choices) ⇒ ChoiceField
constructor
A new instance of ChoiceField.
- #to_h ⇒ Object
Methods inherited from Field
Methods inherited from Base
Constructor Details
#initialize(question, description, required, type, choices) ⇒ ChoiceField
Returns a new instance of ChoiceField.
9 10 11 12 |
# File 'lib/rubytypeformio/choice_field.rb', line 9 def initialize (question, description, required, type, choices) super(question, description, required, type) @choices = choices end |
Instance Attribute Details
#choices ⇒ Object
Returns the value of attribute choices.
7 8 9 |
# File 'lib/rubytypeformio/choice_field.rb', line 7 def choices @choices end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/rubytypeformio/choice_field.rb', line 14 def to_h hash = super.to_h hash[:choices] = [] @choices.each { |c| hash[:choices].push(c.to_h) } return hash end |