Class: Typespec::Or

Inherits:
Object
  • Object
show all
Defined in:
lib/typespec.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*expects) ⇒ Or

Returns a new instance of Or.



45
# File 'lib/typespec.rb', line 45

def initialize(*expects); @expects = [*expects]; end

Class Method Details

.[](*expects) ⇒ Object



46
# File 'lib/typespec.rb', line 46

def self.[](*expects); self.new(*expects); end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


47
# File 'lib/typespec.rb', line 47

def valid?(value); @expects.any?{|expects| expects.valid?(value)}; end