Sha256: 64d2307aeea2d8b4e3853a69550d6de5fb57f73c03fd63de63d505292e7f737c

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

module Terminus
  class Host
    
    attr_reader :host, :port
    
    def initialize(uri)
      @scheme = uri.scheme if uri.respond_to?(:scheme)
      @host   = uri.host
      @port   = uri.port
    end
    
    def scheme
      @scheme || 'http'
    end
    
    def eql?(other)
      host == other.host and
      port == other.port
    end
    alias :== :eql?
    
    def hash
      [host, port].hash
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terminus-0.4.0 lib/terminus/host.rb