class Shaped::Shapes::Any
Public Class Methods
new(*shape_descriptions)
click to toggle source
# File lib/shaped/shapes/any.rb, line 4 def initialize(*shape_descriptions) validation_options = shape_descriptions.extract_options! if shape_descriptions.size <= 1 raise(Shaped::InvalidShapeDescription, <<~ERROR.squish) A #{self.class} description must be a list of two or more shape descriptions. ERROR end @shapes = shape_descriptions.map do |description| Shaped::Shape(description, validation_options) end end
Public Instance Methods
matched_by?(object)
click to toggle source
# File lib/shaped/shapes/any.rb, line 18 def matched_by?(object) @shapes.any? { |shape| shape.matched_by?(object) } end
to_s()
click to toggle source
# File lib/shaped/shapes/any.rb, line 22 def to_s @shapes.map(&:to_s).join(' OR ') end