Class: Arf::Types::ArrayType

Inherits:
BaseType show all
Defined in:
lib/arf/types/array_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseType

#coerce_value, #resolve_type

Constructor Details

#initialize(v) ⇒ ArrayType

Returns a new instance of ArrayType.



8
9
10
11
# File 'lib/arf/types/array_type.rb', line 8

def initialize(v)
  super()
  @type = v
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/arf/types/array_type.rb', line 6

def type
  @type
end

Class Method Details

.[](v) ⇒ Object



13
# File 'lib/arf/types/array_type.rb', line 13

def self.[](v) = new(v)

Instance Method Details

#bind(to) ⇒ Object



19
# File 'lib/arf/types/array_type.rb', line 19

def bind(to) = tap { @bind = to }

#coerce(val) ⇒ Object



21
# File 'lib/arf/types/array_type.rb', line 21

def coerce(val) = val.map { coerce_value(_1, resolved_type) }

#resolved_typeObject



15
16
17
# File 'lib/arf/types/array_type.rb', line 15

def resolved_type
  @resolved_type ||= resolve_type(@type)
end