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.12.0 lib/user_agent/comparable.rb
useragent-0.11.0 lib/user_agent/comparable.rb
delano-useragent-0.0.2 lib/user_agent/comparable.rb
josh-useragent-0.0.2 lib/user_agent/comparable.rb
useragent-0.10.0 lib/user_agent/comparable.rb
useragent-0.9.0 lib/user_agent/comparable.rb
useragent-0.8.3 lib/user_agent/comparable.rb
useragent-0.8.2 lib/user_agent/comparable.rb
useragent-0.8.1 lib/user_agent/comparable.rb
useragent-0.8.0 lib/user_agent/comparable.rb
useragent-0.7.0 lib/user_agent/comparable.rb
useragent-no-extends-0.6.1 lib/user_agent/comparable.rb
friendlyfashion-useragent-0.6.1.1 lib/user_agent/comparable.rb
friendlyfashion-useragent-0.6.1 lib/user_agent/comparable.rb
useragent-0.6.0 lib/user_agent/comparable.rb
useragent-0.5.0 lib/user_agent/comparable.rb
useragent-0.4.16 lib/user_agent/comparable.rb
useragent-0.4.15 lib/user_agent/comparable.rb
useragent-0.4.14 lib/user_agent/comparable.rb
useragent-0.4.13 lib/user_agent/comparable.rb