class T::ArrayType

Attributes

item_type[R]

Public Class Methods

new(item_type) click to toggle source
# File lib/emery/type.rb, line 67
def initialize(item_type)
  @item_type = item_type
end

Public Instance Methods

==(other) click to toggle source
# File lib/emery/type.rb, line 80
def ==(other)
  T.instance_of?(ArrayType, other) and self.item_type == other.item_type
end
check(value) click to toggle source
# File lib/emery/type.rb, line 73
def check(value)
  T.check_not_nil(self, value)
  if !value.is_a? Array
    raise TypeError.new("Value '#{value.inspect.to_s}' type is #{value.class} - Array is required")
  end
  value.each { |item_value| T.check(item_type, item_value) }
end
to_s() click to toggle source
# File lib/emery/type.rb, line 70
def to_s
  "Array[#{item_type.to_s}]"
end