Class: Wizard::Field
- Inherits:
-
Object
- Object
- Wizard::Field
- Defined in:
- lib/wizard/field.rb
Instance Attribute Summary collapse
-
#choices ⇒ Object
readonly
Returns the value of attribute choices.
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#show_in_sidebar ⇒ Object
readonly
Returns the value of attribute show_in_sidebar.
-
#step ⇒ Object
Returns the value of attribute step.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #add_choice(id, opts = nil) ⇒ Object
-
#initialize(attrs) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(attrs) ⇒ Field
Returns a new instance of Field.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wizard/field.rb', line 21 def initialize(attrs) attrs = attrs || {} @id = attrs[:id] @type = attrs[:type] @required = !!attrs[:required] @value = attrs[:value] @icon = attrs[:icon] @disabled = attrs[:disabled] @choices = [] @show_in_sidebar = attrs[:show_in_sidebar] end |
Instance Attribute Details
#choices ⇒ Object (readonly)
Returns the value of attribute choices.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def choices @choices end |
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def disabled @disabled end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def icon @icon end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def id @id end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def required @required end |
#show_in_sidebar ⇒ Object (readonly)
Returns the value of attribute show_in_sidebar.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def @show_in_sidebar end |
#step ⇒ Object
Returns the value of attribute step.
19 20 21 |
# File 'lib/wizard/field.rb', line 19 def step @step end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
18 19 20 |
# File 'lib/wizard/field.rb', line 18 def value @value end |