Class: AnyValue::AnyUnique
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize ⇒ AnyUnique
constructor
A new instance of AnyUnique.
Methods inherited from Anything
#^, #inspect, #to_ary, #to_str
Constructor Details
#initialize ⇒ AnyUnique
Returns a new instance of AnyUnique.
208 209 210 |
# File 'lib/any_value.rb', line 208 def initialize @seen = Set.new end |
Instance Method Details
#==(o) ⇒ Object
211 212 213 214 215 216 217 218 |
# File 'lib/any_value.rb', line 211 def ==(o) if @seen.include?(o) false else @seen << o true end end |