Module: ActiveModel::AttributeReader
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_model/attribute_reader.rb,
lib/active_model/attribute_reader/version.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#initialize(attributes = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/active_model/attribute_reader.rb', line 8 def initialize(attributes = {}) if self.class.attribute_readers self.class.attribute_readers.each do |attribute| next if respond_to?(:"#{attribute}=") value = attributes.delete(attribute) instance_variable_set(:"@#{attribute}", value) end end super(attributes) end |