Module: Golden::Setting::FormOption
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #field_type ⇒ Object
- #field_type=(new_value) ⇒ Object
- #field_values ⇒ Object
- #field_values=(new_value) ⇒ Object
- #form_options ⇒ Object
- #initialize(attributes = nil, options = {}) ⇒ Object
Instance Method Details
#field_type ⇒ Object
45 46 47 |
# File 'lib/golden/setting/form_option.rb', line 45 def field_type [:type] end |
#field_type=(new_value) ⇒ Object
49 50 51 52 |
# File 'lib/golden/setting/form_option.rb', line 49 def field_type= new_value return unless new_value self.[:type] = new_value.to_sym end |
#field_values ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/golden/setting/form_option.rb', line 54 def field_values case [:collection] when String eval [:collection] else [:collection] end end |
#field_values=(new_value) ⇒ Object
63 64 65 66 |
# File 'lib/golden/setting/form_option.rb', line 63 def field_values= new_value return unless new_value self.[:collection] = eval(new_value) end |
#form_options ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/golden/setting/form_option.rb', line 34 def case self[:form_options] when String YAML::load self[:form_options] when Hash super else self[:form_options] = .dup end end |
#initialize(attributes = nil, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/golden/setting/form_option.rb', line 29 def initialize attributes = nil, = {} super attributes, self. end |