Module: Hashie::Extensions::Dash::IndifferentAccess::ClassMethods
- Defined in:
- lib/hashie/extensions/dash/indifferent_access.rb
Instance Method Summary collapse
-
#property?(name) ⇒ Boolean
Check to see if the specified property has already been defined.
- #transformation_exists?(name) ⇒ Boolean
- #transformed_property(property_name, value) ⇒ Object
- #translation_exists?(name) ⇒ Boolean
Instance Method Details
#property?(name) ⇒ Boolean
Check to see if the specified property has already been defined.
34 35 36 37 38 |
# File 'lib/hashie/extensions/dash/indifferent_access.rb', line 34 def property?(name) name = translations[name.to_sym] if translation_for?(name) name = name.to_s !!properties.find { |property| property.to_s == name } end |
#transformation_exists?(name) ⇒ Boolean
50 51 52 53 |
# File 'lib/hashie/extensions/dash/indifferent_access.rb', line 50 def transformation_exists?(name) name = name.to_s !!transforms.keys.find { |key| key.to_s == name } end |
#transformed_property(property_name, value) ⇒ Object
45 46 47 48 |
# File 'lib/hashie/extensions/dash/indifferent_access.rb', line 45 def transformed_property(property_name, value) transform = transforms[property_name] || transforms[property_name.to_sym] transform.call(value) end |
#translation_exists?(name) ⇒ Boolean
40 41 42 43 |
# File 'lib/hashie/extensions/dash/indifferent_access.rb', line 40 def translation_exists?(name) name = name.to_s !!translations.keys.find { |key| key.to_s == name } end |