class Fried::Typings::ArrayOf

Checks if all elements of the array match given type

Attributes

type[R]

Public Class Methods

new(type) click to toggle source
# File lib/fried/typings/array_of.rb, line 19
def initialize(type)
  @type = type
end

Public Instance Methods

valid?(ary) click to toggle source

@param ary [Array]

# File lib/fried/typings/array_of.rb, line 24
def valid?(ary)
  return false unless Is[Array].valid?(ary)

  enumerator = ary.each

  EnumeratorOf[type].valid?(enumerator)
end