Class: Dry::Types::Array

Inherits:
Definition show all
Defined in:
lib/dry/types/array.rb,
lib/dry/types/array/member.rb

Direct Known Subclasses

Member

Defined Under Namespace

Classes: Member

Instance Attribute Summary

Attributes inherited from Definition

#options, #primitive

Attributes included from Options

#options

Instance Method Summary collapse

Methods inherited from Definition

[], #call, #constrained?, #default?, #failure, #initialize, #name, #primitive?, #result, #success, #try

Methods included from Builder

#constrained, #constrained_type, #constructor, #default, #enum, #maybe, #optional, #safe, #|

Methods included from Options

#initialize, #meta, #with

Constructor Details

This class inherits a constructor from Dry::Types::Definition

Instance Method Details

#member(type) ⇒ Array::Member

Parameters:

Returns:



8
9
10
11
12
13
14
15
16
# File 'lib/dry/types/array.rb', line 8

def member(type)
  member =
    case type
    when String, Class then Types[type]
    else type
    end

  Array::Member.new(primitive, options.merge(member: member))
end