Class: JsonStructure::AnyOf
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(*types) ⇒ AnyOf
constructor
A new instance of AnyOf.
- #|(type) ⇒ Object
Constructor Details
#initialize(*types) ⇒ AnyOf
Returns a new instance of AnyOf.
3 4 5 |
# File 'lib/json_structure/any_of.rb', line 3 def initialize(*types) @types = types end |
Instance Method Details
#===(value) ⇒ Object
7 8 9 |
# File 'lib/json_structure/any_of.rb', line 7 def ===(value) @types.any? { |type| type === value } end |
#|(type) ⇒ Object
11 12 13 |
# File 'lib/json_structure/any_of.rb', line 11 def |(type) AnyOf.new(*(@types + [type])) end |