module Flatter::Mapper::Collection::Concern::ClassMethods
Public Instance Methods
key(arg = nil)
click to toggle source
# File lib/flatter/mapper/collection.rb, line 35 def key(arg = nil) args = [] options = {writer: false} case arg when String, Symbol options[:key] = arg.to_sym when Proc args << :key options[:reader] = arg else fail ArgumentError, "Cannot use '#{arg}' as collection key" end map *args, **options end