Sha256: 59e74fa3734e386962d885c032725847f9d5468d83d5c7acf5b7ecc4c37bb56b
Contents?: true
Size: 693 Bytes
Versions: 6
Compression:
Stored size: 693 Bytes
Contents
module Attributor class Ids < CSV def self.for(type) identity_name = type.options.fetch(:identity) do raise AttributorException, "no identity found for #{type.name}" end identity_attribute = type.attributes.fetch(identity_name) do raise AttributorException, "#{type.name} does not have attribute with name '#{identity_name}'" end ::Class.new(self) do @member_attribute = identity_attribute @member_type = identity_attribute.type end end def self.of(type) raise "Invalid definition of Ids type. Defining Ids.of(type) is not allowed, you probably meant to do Ids.for(type) instead" end end end
Version data entries
6 entries across 6 versions & 1 rubygems