Module: HumanAttributeValue

Extended by:
ActiveSupport::Concern
Defined in:
lib/human_attribute_value.rb,
lib/human_attribute_value/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#human_attribute_value(attribute, options = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/human_attribute_value.rb', line 40

def human_attribute_value(attribute, options = {})
  value = public_send(attribute)

  if value.present?
    if value.is_a?(Array)
      value.map { |el| self.class.human_attribute_value(attribute, el, options) }
    else
      self.class.human_attribute_value(attribute, value, options)
    end
  end
end