Method: ROM::Mapping::Definition#map

Defined in:
lib/rom/mapping/definition.rb

#map(*args) ⇒ Definition

Configure attribute mappings

Examples:


Mapping.build do
  users do
    map :id, :email
    map :user_name, to: :name
  end
end

Returns:



105
106
107
108
109
110
111
112
113
# File 'lib/rom/mapping/definition.rb', line 105

def map(*args)
  options = args.last

  if options.kind_of?(Hash)
    mapping.update(args.first => options[:to])
  else
    @attributes += Set[*args]
  end
end