Skip to content

Instantly share code, notes, and snippets.

@metanest
Created April 11, 2018 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metanest/4cd7ccfb54ce3e240a77cc408f33c44b to your computer and use it in GitHub Desktop.
Save metanest/4cd7ccfb54ce3e240a77cc408f33c44b to your computer and use it in GitHub Desktop.
#! /usr/local/bin/ruby25
class Integer
alias :' >' :'>'
alias :' <' :'<'
def >(other)
if self.send(:' >', other) then
other
else
nil
end
end
def <(other)
if self.send(:' <', other) then
other
else
nil
end
end
end
class NilClass
def >(other)
self
end
def <(other)
self
end
end
p(if 1<2<3 then 'Y' else 'N' end)
p(if 1<2>3 then 'Y' else 'N' end)
p(if 1>2<3 then 'Y' else 'N' end)
p(if 1>2>3 then 'Y' else 'N' end)
p(if 3<2<1 then 'Y' else 'N' end)
p(if 3<2>1 then 'Y' else 'N' end)
p(if 3>2<1 then 'Y' else 'N' end)
p(if 3>2>1 then 'Y' else 'N' end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment