Module: Encore::Entity::Input::ClassMethods

Defined in:
lib/encore/entity/input.rb

Instance Method Summary collapse

Instance Method Details

#map_attributes(klass, params) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/encore/entity/input.rb', line 61

def map_attributes(klass, params)
  params.inject({}) do |memo, (attribute, value)|
    exposed_attribute = klass.exposed_attributes.detect { |a| a.attribute == attribute }
    key = exposed_attribute || Attribute.new(klass, attribute.to_sym)

    memo.merge key => value
  end
end