Sha256: a70d768685817edf7893e503b719abc51e1d0c834f601736c89782863d1f1f71
Contents?: true
Size: 497 Bytes
Versions: 17
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: true class Shaped::Shapes::Array < Shaped::Shape def initialize(shape_description) if !shape_description.is_a?(Array) raise(Shaped::InvalidShapeDescription, "A #{self.class} description must be an array.") end @element_test = Shaped::Shape(*shape_description) end def matched_by?(array) return false if !array.is_a?(Array) array.all? { |element| @element_test.matched_by?(element) } end def to_s "[#{@element_test}]" end end
Version data entries
17 entries across 17 versions & 1 rubygems