class Rtype::Behavior::TypedArray
Typed array behavior. empty array allowed
Public Class Methods
new(type)
click to toggle source
# File lib/rtype/behavior/typed_array.rb, line 5 def initialize(type) @type = type Rtype.assert_valid_argument_type_sig_element(@type) end
Public Instance Methods
error_message(value)
click to toggle source
# File lib/rtype/behavior/typed_array.rb, line 21 def error_message(value) "Expected #{value.inspect} to be an array with type #{@type.inspect}" end
valid?(value)
click to toggle source
# File lib/rtype/behavior/typed_array.rb, line 10 def valid?(value) if value.is_a?(Array) any = value.any? do |e| !Rtype::valid?(@type, e) end !any else false end end