Class: LightForm::Lash
- Inherits:
-
Hash
- Object
- Hash
- LightForm::Lash
- Includes:
- ActiveModel::Model, PropertyMethods
- Defined in:
- lib/light_form/lash.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Lash
constructor
A new instance of Lash.
Methods included from PropertyMethods
#_errors, #errors_overriden?, included, #valid?
Constructor Details
#initialize(params = {}) ⇒ Lash
Returns a new instance of Lash.
8 9 10 |
# File 'lib/light_form/lash.rb', line 8 def initialize(params = {}) _prepare_params(params).each_pair { |k, v| self[k.to_sym] = v } end |
Class Method Details
._add_property(prop_name) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/light_form/lash.rb', line 12 def self._add_property(prop_name) config[:errors_overriden] = true if prop_name == :errors return unless _properties.add?(prop_name) define_method(prop_name) { |&block| self.[](prop_name, &block) } property_assignment = "#{prop_name}=".to_sym define_method(property_assignment) { |value| self.[]=(prop_name, value) } end |