Sha256: 2ee40290af8e1e9ffa77018c327cf9c5faa2a1abdedc6543f0ae19ca86db6038

Contents?: true

Size: 510 Bytes

Versions: 74

Compression:

Stored size: 510 Bytes

Contents

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

Version data entries

74 entries across 74 versions & 7 rubygems

Version Path
useragent-0.16.11 lib/user_agent/comparable.rb
useragent-0.16.10 lib/user_agent/comparable.rb
useragent-0.16.9 lib/user_agent/comparable.rb
useragent-0.16.8 lib/user_agent/comparable.rb
useragent-0.16.7 lib/user_agent/comparable.rb
useragent-0.16.6 lib/user_agent/comparable.rb
useragent-0.16.5 lib/user_agent/comparable.rb
useragent-0.16.4 lib/user_agent/comparable.rb
useragent-0.16.3 lib/user_agent/comparable.rb
useragent-0.16.2 lib/user_agent/comparable.rb
useragent-0.16.1 lib/user_agent/comparable.rb
useragent-0.16.0 lib/user_agent/comparable.rb
useragent-0.15.2 lib/user_agent/comparable.rb
useragent-0.15.1 lib/user_agent/comparable.rb
useragent-0.15.0 lib/user_agent/comparable.rb
useragent-0.14.0 lib/user_agent/comparable.rb
useragent-0.13.3 lib/user_agent/comparable.rb
useragent-0.13.2 lib/user_agent/comparable.rb
useragent-0.13.1 lib/user_agent/comparable.rb
useragent-0.13.0 lib/user_agent/comparable.rb