module UserAgent::Comparable

A custom Comparable module that will always return false if the <=> returns false

Public Instance Methods

<(other) click to toggle source
# File lib/user_agent/comparable.rb, line 5
def <(other)
  (c = self <=> other) ? c == -1 : false
end
<=(other) click to toggle source
# File lib/user_agent/comparable.rb, line 9
def <=(other)
  (c = self <=> other) ? c == -1 || c == 0 : false
end
==(other) click to toggle source
# File lib/user_agent/comparable.rb, line 13
def ==(other)
  (c = self <=> other) ? c == 0 : false
end
>(other) click to toggle source
# File lib/user_agent/comparable.rb, line 17
def >(other)
  (c = self <=> other) ? c == 1 : false
end
>=(other) click to toggle source
# File lib/user_agent/comparable.rb, line 21
def >=(other)
  (c = self <=> other) ? c == 1 || c == 0 : false
end