Sha256: 9b7c138ae8a9c073e12cbcf19cf129889f20986b54e438fbd6a85d539213c72e
Contents?: true
Size: 510 Bytes
Versions: 2
Compression:
Stored size: 510 Bytes
Contents
# frozen_string_literal: true module ModelAuditor class AttributeReader attr_reader :model, :key def initialize(model, key) @model = model @key = key end def value associated_attr_value || array_attr_value || model.send(key) end private def associated_attr_value ModelAuditor::AttributeReaders::Associated.new(model, key).value end def array_attr_value ModelAuditor::AttributeReaders::ArrayField.new(model, key).value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
model_auditor-0.0.2 | lib/model_auditor/attribute_reader.rb |
model_auditor-0.0.1 | lib/model_auditor/attribute_reader.rb |