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.



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

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

Instance Method Details

#==(o) ⇒ Object



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

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

#inspectObject



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

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