Skip to content

Instantly share code, notes, and snippets.

View sobrinho's full-sized avatar

Gabriel Sobrinho sobrinho

View GitHub Profile
@sobrinho
sobrinho / or.rb
Created October 3, 2012 10:42
Proof of concept for `(a | b).empty?` on ruby
class Or < BasicObject
def initialize(a, b)
@a = a
@b = b
end
def method_missing(method_name, *arguments, &block)
@a.send(method_name, *arguments, &block) || @b.send(method_name, *arguments, &block)
end
end