Module: ActiveModel::Attribute
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_model/attribute.rb
Instance Method Summary collapse
Instance Method Details
#attributes ⇒ Object
46 47 48 |
# File 'lib/active_model/attribute.rb', line 46 def attributes slice(*self.class.attributes) end |
#initialize(attrs = {}) ⇒ Object
40 41 42 43 44 |
# File 'lib/active_model/attribute.rb', line 40 def initialize(attrs = {}) assign_attributes(attrs) if attrs super() end |
#slice(*attrs) ⇒ Object
50 51 52 53 54 |
# File 'lib/active_model/attribute.rb', line 50 def slice(*attrs) attrs.each_with_object({}) do |name, hash| hash[name] = send(name) end end |