class Shaped::Shapes::Array
Public Class Methods
new(shape_description)
click to toggle source
# File lib/shaped/shapes/array.rb, line 4 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
Public Instance Methods
matched_by?(array)
click to toggle source
# File lib/shaped/shapes/array.rb, line 12 def matched_by?(array) return false if !array.is_a?(Array) array.all? { |element| @element_test.matched_by?(element) } end
to_s()
click to toggle source
# File lib/shaped/shapes/array.rb, line 18 def to_s "[#{@element_test}]" end