Extends array comparsion method : Array Extension « Array « Ruby
- Ruby
- Array
- Array Extension
Extends array comparsion method
class Array
def <(other)
(self <=> other) == -1
end
def <=(other)
(self < other) or (self == other)
end
def >(other)
(self <=> other) == 1
end
def >=(other)
(self > other) or (self == other)
end
end
Related examples in the same category