Class: Formation::Types::Checkbox
- Inherits:
-
Object
- Object
- Formation::Types::Checkbox
- Defined in:
- lib/formation/types/checkbox.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
-
#initialize(field) ⇒ Checkbox
constructor
A new instance of Checkbox.
- #to_html ⇒ Object
Constructor Details
#initialize(field) ⇒ Checkbox
Returns a new instance of Checkbox.
5 6 7 |
# File 'lib/formation/types/checkbox.rb', line 5 def initialize(field) @field = field end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
3 4 5 |
# File 'lib/formation/types/checkbox.rb', line 3 def field @field end |
Instance Method Details
#to_html ⇒ Object
9 10 11 12 13 |
# File 'lib/formation/types/checkbox.rb', line 9 def to_html <<-HTML.strip <input type="checkbox" name="#{field.name}" value="1" checked="#{field.value ? 'checked' : ''}" /> HTML end |