Class: Brock::BooleanField
- Defined in:
- lib/brock/fields/boolean_field.rb
Instance Attribute Summary
Attributes inherited from Field
#description, #label, #name, #type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Field
detect, #initialize, new_from_params, #to_html
Constructor Details
This class inherits a constructor from Brock::Field
Class Method Details
.type ⇒ Object
6 7 8 |
# File 'lib/brock/fields/boolean_field.rb', line 6 def self.type :boolean end |
Instance Method Details
#default ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/brock/fields/boolean_field.rb', line 10 def default if @params.has_key?('default') @params['default'] else true end end |
#parse_param(value) ⇒ Object
18 19 20 |
# File 'lib/brock/fields/boolean_field.rb', line 18 def parse_param(value) value == 'on' || value == '1' || value == 'true' || value == true end |