Class: Brock::SelectField

Inherits:
Field
  • Object
show all
Defined in:
lib/brock/fields/select_field.rb

Instance Attribute Summary

Attributes inherited from Field

#default, #description, #label, #name, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Field

#initialize, new_from_params, #to_html

Constructor Details

This class inherits a constructor from Brock::Field

Class Method Details

.detect(field) ⇒ Object



10
11
12
13
14
15
# File 'lib/brock/fields/select_field.rb', line 10

def self.detect(field)
  super(field) or (
    field['values'] and
    (field['type'] == 'string' or not field.has_key?('type'))
  )
end

.typeObject



6
7
8
# File 'lib/brock/fields/select_field.rb', line 6

def self.type
  :select
end

Instance Method Details

#parse_param(value) ⇒ Object



17
18
19
# File 'lib/brock/fields/select_field.rb', line 17

def parse_param(value)
  value.to_s
end

#valuesObject



21
22
23
# File 'lib/brock/fields/select_field.rb', line 21

def values
  @params['values'] || []
end