Class: Hashape::Specifiers::OneOf
Overview
Given a list of type specs, allows the value to match any one of those type specs.
Instance Attribute Summary
Attributes inherited from Specifier
Instance Method Summary collapse
Methods inherited from Specifier
Constructor Details
This class inherits a constructor from Hashape::Specifiers::Specifier
Instance Method Details
#===(v) ⇒ Object
46 47 48 49 |
# File 'lib/hashape.rb', line 46 def ===(v) raise 'spec for OneOf must be an array' unless self.spec.is_a?(Array) self.spec.any? { |s| s === v } end |