Class: ModelAuditor::AttributeReaders::Associated
- Inherits:
-
Object
- Object
- ModelAuditor::AttributeReaders::Associated
- Defined in:
- lib/model_auditor/attribute_readers/associated.rb
Direct Known Subclasses
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) ⇒ Associated
constructor
A new instance of Associated.
- #value ⇒ Object
Constructor Details
#initialize(model, key) ⇒ Associated
Returns a new instance of Associated.
8 9 10 11 |
# File 'lib/model_auditor/attribute_readers/associated.rb', line 8 def initialize(model, key) @model = model @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/model_auditor/attribute_readers/associated.rb', line 6 def key @key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/model_auditor/attribute_readers/associated.rb', line 6 def model @model end |
Instance Method Details
#value ⇒ Object
13 14 15 16 17 |
# File 'lib/model_auditor/attribute_readers/associated.rb', line 13 def value return unless method_name model.send(method_name)&.title end |