Module: Golden::ExtendedAttrAccessor
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationContext, ApplicationForm
- Defined in:
- lib/golden/attribute_accessors/extended_attr_accessor.rb
Instance Method Summary collapse
-
#attributes ⇒ Object
NOTE: conflict with ActiveModel::Attributes#attributes.
- #strip_attributes(attrs) ⇒ Object
- #strip_attributes!(attrs) ⇒ Object
Instance Method Details
#attributes ⇒ Object
NOTE: conflict with ActiveModel::Attributes#attributes
35 36 37 38 39 |
# File 'lib/golden/attribute_accessors/extended_attr_accessor.rb', line 35 def attributes self.class.attributes.inject({}) do |hash, attribute| hash.merge(attribute => public_send(attribute)) end.with_indifferent_access end |
#strip_attributes(attrs) ⇒ Object
41 42 43 44 45 |
# File 'lib/golden/attribute_accessors/extended_attr_accessor.rb', line 41 def strip_attributes(attrs) attrs.transform_values do |value| value.respond_to?(:strip) ? value.strip : value end end |
#strip_attributes!(attrs) ⇒ Object
47 48 49 50 51 |
# File 'lib/golden/attribute_accessors/extended_attr_accessor.rb', line 47 def strip_attributes!(attrs) attrs.transform_values do |value| value.respond_to?(:strip!) ? value.strip! : value end end |