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
5 6 7 |
# File 'lib/hashme/properties.rb', line 5 def get_attribute(name) self[name] end |
#set_attribute(name, value) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/hashme/properties.rb', line 9 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 |