diff --git a/lib/user_agent.rb b/lib/user_agent.rb index f031a2b..62e6973 100644 --- a/lib/user_agent.rb +++ b/lib/user_agent.rb @@ -1,4 +1,3 @@ -require 'user_agent/comparable' require 'user_agent/browsers' require 'user_agent/operating_systems' require 'user_agent/version' @@ -61,7 +60,7 @@ def <=>(other) if @product == other.product @version <=> other.version else - false + nil end end diff --git a/lib/user_agent/browsers/base.rb b/lib/user_agent/browsers/base.rb index b365c16..db6b80d 100644 --- a/lib/user_agent/browsers/base.rb +++ b/lib/user_agent/browsers/base.rb @@ -8,7 +8,7 @@ def <=>(other) browser == other.browser version <=> Version.new(other.version) else - false + nil end end diff --git a/lib/user_agent/comparable.rb b/lib/user_agent/comparable.rb deleted file mode 100644 index e1246c0..0000000 --- a/lib/user_agent/comparable.rb +++ /dev/null @@ -1,25 +0,0 @@ -class UserAgent - # A custom Comparable module that will always return false - # if the <=> returns false - module Comparable - def <(other) - (c = self <=> other) ? c == -1 : false - end - - def <=(other) - (c = self <=> other) ? c == -1 || c == 0 : false - end - - def ==(other) - (c = self <=> other) ? c == 0 : false - end - - def >(other) - (c = self <=> other) ? c == 1 : false - end - - def >=(other) - (c = self <=> other) ? c == 1 || c == 0 : false - end - end -end diff --git a/lib/user_agent/version.rb b/lib/user_agent/version.rb index 5bc32d8..f8154f0 100644 --- a/lib/user_agent/version.rb +++ b/lib/user_agent/version.rb @@ -1,6 +1,6 @@ class UserAgent class Version - include ::Comparable + include Comparable def self.new(obj = nil) case obj diff --git a/useragent.gemspec b/useragent.gemspec index 999b09e..66a574c 100644 --- a/useragent.gemspec +++ b/useragent.gemspec @@ -24,7 +24,6 @@ Gem::Specification.new do |s| "lib/user_agent/browsers/podcast_addict.rb", "lib/user_agent/browsers/webkit.rb", "lib/user_agent/browsers/windows_media_player.rb", - "lib/user_agent/comparable.rb", "lib/user_agent/operating_systems.rb", "lib/user_agent/version.rb", "lib/useragent.rb",