Sha256: e8a1bb338a3c1051a80f6d7bdd42e08e7a9ffa63ee964931f8fb894c868bc4cd
Contents?: true
Size: 691 Bytes
Versions: 11
Compression:
Stored size: 691 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
11 entries across 11 versions & 1 rubygems