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

#primitive

Attributes included from Options

#options

Instance Method Summary collapse

Methods inherited from Definition

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

Methods included from Builder

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

Methods included from Options

#initialize, #meta, #pristine, #with

Constructor Details

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

Instance Method Details

#of(type) ⇒ Array::Member

Parameters:

Returns:



11
12
13
14
15
16
17
18
19
# File 'lib/dry/types/array.rb', line 11

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

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