Skip to content
Permalink
Browse files

doh fix

  • Loading branch information
Alex Gaynor
Alex Gaynor committed May 12, 2013
1 parent 095c6f2 commit 14b8b76cbfb19941deda0e308707b8517ec0335a
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib-topaz/array.rb
@@ -378,22 +378,22 @@ def to_a
def &(other)
other = Topaz.convert_type(other, Array, :to_ary)
h = {}
other.each { |e| h[e] = nil }
other.each { |e| h[e] = true }
self.select { |e| h.delete(e) }
end

def |(other)
other = Topaz.convert_type(other, Array, :to_ary)
h = {}
self.each { |e| h[e] = nil }
other.each { |e| h.fetch(e) { |v| h[v] = nil } }
self.each { |e| h[e] = true }
other.each { |e| h.fetch(e) { |v| h[v] = true } }
h.keys
end

def -(other)
other = Topaz.convert_type(other, Array, :to_ary)
h = {}
other.each { |e| h[e] = nil }
other.each { |e| h[e] = true }
self.reject { |e| h.has_key?(e) }
end
end

0 comments on commit 14b8b76

Please sign in to comment.
You can’t perform that action at this time.