class AttributedObject::Types::ArrayOf
Public Class Methods
new(type_info)
click to toggle source
# File lib/attributed_object/types/array_of.rb, line 4 def initialize(type_info) @type_info = type_info end
Public Instance Methods
coerce(array)
click to toggle source
# File lib/attributed_object/types/array_of.rb, line 13 def coerce(array) raise AttributedObject::UncoercibleValueError.new("Trying to coerce into Array but value is not an array") if !array.is_a?(Array) array.map { |e| AttributedObjectHelpers::TypeCoerce.coerce(@type_info, e) } end
strict_check(array)
click to toggle source
# File lib/attributed_object/types/array_of.rb, line 8 def strict_check(array) return false if !array.is_a?(Array) array.all?{ |e| AttributedObjectHelpers::TypeCheck.check(@type_info, e) } end