Sha256: 59b3ff73a6b9ca69bc86d16365f4af4a33b642f83d50c6e64354ced0761bef87

Contents?: true

Size: 405 Bytes

Versions: 2

Compression:

Stored size: 405 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

2 entries across 2 versions & 1 rubygems

Version Path
terminus-0.6.0 lib/terminus/host.rb
terminus-0.5.0 lib/terminus/host.rb