Sha256: 1a8e6dfb7ca9bd54d9ff71b3965224caf2a6f36764ccb99c0a16dfe0189339c7
Contents?: true
Size: 717 Bytes
Versions: 2
Compression:
Stored size: 717 Bytes
Contents
module Dry module Data class Type class Array < Type def self.constructor(array_constructor, member_constructor, input) array_constructor[input].map(&member_constructor) end def member(type) member_constructor = case type when Type then type.constructor when Class then Data[type].constructor else raise ArgumentError, "+#{type}+ is an unsupported array member" end array_constructor = self.class .method(:constructor).to_proc.curry.(constructor, member_constructor) self.class.new(array_constructor, primitive) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dry-data-0.4.1 | lib/dry/data/type/array.rb |
dry-data-0.4.0 | lib/dry/data/type/array.rb |