class ValueSemantics::Either

Validator that matches if any of the given subvalidators matches

Attributes

subvalidators[R]

Public Class Methods

new(subvalidators) click to toggle source
# File lib/value_semantics/either.rb, line 8
def initialize(subvalidators)
  @subvalidators = subvalidators
  freeze
end

Public Instance Methods

===(value) click to toggle source

@return [Boolean]

# File lib/value_semantics/either.rb, line 14
def ===(value)
  subvalidators.any? { |sv| sv === value }
end