mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
64 lines
894 B
Ruby
64 lines
894 B
Ruby
### move to compar.c
|
|
# module Comparable
|
|
# def == other
|
|
# cmp = self <=> other
|
|
# if cmp == 0
|
|
# true
|
|
# else
|
|
# false
|
|
# end
|
|
# end
|
|
|
|
# def < other
|
|
# cmp = self <=> other
|
|
# if cmp.nil?
|
|
# false
|
|
# elsif cmp < 0
|
|
# true
|
|
# else
|
|
# false
|
|
# end
|
|
# end
|
|
|
|
# def <= other
|
|
# cmp = self <=> other
|
|
# if cmp.nil?
|
|
# false
|
|
# elsif cmp <= 0
|
|
# true
|
|
# else
|
|
# false
|
|
# end
|
|
# end
|
|
|
|
# def > other
|
|
# cmp = self <=> other
|
|
# if cmp.nil?
|
|
# false
|
|
# elsif cmp > 0
|
|
# true
|
|
# else
|
|
# false
|
|
# end
|
|
# end
|
|
|
|
# def >= other
|
|
# cmp = self <=> other
|
|
# if cmp.nil?
|
|
# false
|
|
# elsif cmp >= 0
|
|
# true
|
|
# else
|
|
# false
|
|
# end
|
|
# end
|
|
|
|
# def between?(min,max)
|
|
# if self < min or self > max
|
|
# false
|
|
# else
|
|
# true
|
|
# end
|
|
# end
|
|
# end
|