Class: EasySettings::FloatKey
- Defined in:
- lib/redmine_extensions/easy_settings/key.rb
Instance Attribute Summary
Attributes inherited from Key
Instance Method Summary collapse
Methods inherited from Key
#after_save, #default, #disabled_from_params?, init, #initialize, #skip_blank_params?
Constructor Details
This class inherits a constructor from EasySettings::Key
Instance Method Details
#from_params(easy_setting, value) ⇒ Object
100 101 102 |
# File 'lib/redmine_extensions/easy_settings/key.rb', line 100 def from_params(easy_setting, value) value.try(:to_f) end |
#validate(easy_setting) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/redmine_extensions/easy_settings/key.rb', line 104 def validate(easy_setting) easy_setting.instance_eval do if !value.nil? && !value.is_a?(Float) errors.add(:base, "#{name} must be float") end end end |