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