Module: Flatter::Mapper::Collection::Concern::ClassMethods
- Defined in:
- lib/flatter/mapper/collection.rb
Instance Method Summary collapse
Instance Method Details
#key(arg = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/flatter/mapper/collection.rb', line 35 def key(arg = nil) args = [] = {writer: false} case arg when String, Symbol [:key] = arg.to_sym when Proc args << :key [:reader] = arg else fail ArgumentError, "Cannot use '#{arg}' as collection key" end map *args, ** end |