Class: AnyValue::OneOf

Inherits:
Anything show all
Defined in:
lib/any_value.rb

Instance Method Summary collapse

Methods inherited from Anything

#^, #to_ary, #to_str

Constructor Details

#initialize(*values) ⇒ OneOf

Returns a new instance of OneOf.



116
117
118
119
# File 'lib/any_value.rb', line 116

def initialize(*values)
  super
  @values = values
end

Instance Method Details

#==(o) ⇒ Object



121
122
123
# File 'lib/any_value.rb', line 121

def ==(o)
  @values.include?(o)
end

#inspectObject



125
126
127
# File 'lib/any_value.rb', line 125

def inspect
  "#<OneOf #{@values.map(&:inspect).join(" ")}>"
end