class ModelAuditor::AttributeReader

Attributes

key[R]
model[R]

Public Class Methods

new(model, key) click to toggle source
# File lib/model_auditor/attribute_reader.rb, line 7
def initialize(model, key)
  @model = model
  @key = key
end

Public Instance Methods

value() click to toggle source
# File lib/model_auditor/attribute_reader.rb, line 12
def value
  associated_attr_value || array_attr_value || model.send(key)
end

Private Instance Methods

array_attr_value() click to toggle source
# File lib/model_auditor/attribute_reader.rb, line 22
def array_attr_value
  ModelAuditor::AttributeReaders::ArrayField.new(model, key).value
end
associated_attr_value() click to toggle source
# File lib/model_auditor/attribute_reader.rb, line 18
def associated_attr_value
  ModelAuditor::AttributeReaders::Associated.new(model, key).value
end