Class: ModelAuditor::AttributeReader
- Inherits:
-
Object
- Object
- ModelAuditor::AttributeReader
- Defined in:
- lib/model_auditor/attribute_reader.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(model, key) ⇒ AttributeReader
constructor
A new instance of AttributeReader.
- #value ⇒ Object
Constructor Details
#initialize(model, key) ⇒ AttributeReader
Returns a new instance of AttributeReader.
7 8 9 10 |
# File 'lib/model_auditor/attribute_reader.rb', line 7 def initialize(model, key) @model = model @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/model_auditor/attribute_reader.rb', line 5 def key @key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
5 6 7 |
# File 'lib/model_auditor/attribute_reader.rb', line 5 def model @model end |
Instance Method Details
#value ⇒ Object
12 13 14 |
# File 'lib/model_auditor/attribute_reader.rb', line 12 def value associated_attr_value || array_attr_value || model.send(key) end |