Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /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)
Add Comment
Please, Sign In to add comment