Sha256: 89d6ab0ee7210046f17220e4a6a374729ed681184edafa04428199370287e043
Contents?: true
Size: 636 Bytes
Versions: 7
Compression:
Stored size: 636 Bytes
Contents
module Petfinder module JsonMapper def json_attributes(*names) names.each { |name| json_attribute(name) } end def json_attribute name define_method name do if name.include? "_" camelName = name.split("_").map { |word| word.capitalize unless word == (name.split("_").first) }.join @attributes.dig(camelName, "$t") elsif @attributes.dig(name, "$t") @attributes.dig(name, "$t") elsif @attributes.dig("contact", name, "$t") @attributes.dig("contact", name, "$t") else @attributes["#{name}"] end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems