Module: Hashme::Properties
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/hashme/properties.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#get_attribute(name) ⇒ Object
10 11 12 |
# File 'lib/hashme/properties.rb', line 10 def get_attribute(name) self[name] end |
#set_attribute(name, value) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/hashme/properties.rb', line 14 def set_attribute(name, value) property = get_property(name) if property.nil? self[name.to_sym] = value else self[property.name] = value.present? ? property.cast(self, value) : value end end |