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.2.0 lib/user_agent/comparable.rb
useragent-0.1.6 lib/user_agent/comparable.rb
useragent-0.1.5 lib/user_agent/comparable.rb
useragent-0.1.4 lib/user_agent/comparable.rb
useragent-0.1.3 lib/user_agent/comparable.rb
useragent-0.1.1 lib/user_agent/comparable.rb
useragent-0.1.0 lib/user_agent/comparable.rb
useragent-0.0.5 lib/user_agent/comparable.rb
useragent-0.0.4 lib/user_agent/comparable.rb
stella-0.5.4 vendor/useragent/lib/user_agent/comparable.rb
stella-0.5.1 vendor/useragent/lib/user_agent/comparable.rb
stella-0.5.3 vendor/useragent/lib/user_agent/comparable.rb
stella-0.5.5 vendor/useragent/lib/user_agent/comparable.rb
stella-0.3.2 vendor/useragent/lib/user_agent/comparable.rb