Class: Formation::Types::Checkbox

Inherits:
Object
  • Object
show all
Defined in:
lib/formation/types/checkbox.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fieldObject (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_htmlObject



9
10
11
12
13
# File 'lib/formation/types/checkbox.rb', line 9

def to_html
  "    <input type=\"checkbox\" name=\"\#{field.name}\" value=\"1\" checked=\"\#{field.value ? 'checked' : ''}\" />\n  HTML\nend\n".strip