Sha256: a7ddac9792152d8ef343f1921d8569a80574412aff12669bbcc8a81a5f886b9d
Contents?: true
Size: 993 Bytes
Versions: 13
Compression:
Stored size: 993 Bytes
Contents
require 'asir' require 'uri' module ASIR module UriConfig attr_accessor :uri, :scheme, :host, :port, :path attr_accessor :scheme_default, :host_default, :port_default, :path_default alias :protocol :scheme alias :protocol= :scheme= alias :address :host alias :address= :host= def uri @uri ||= "#{scheme}://#{host}:#{port}" end def _uri @_uri ||= URI === @uri ? @uri : URI.parse(uri) end def scheme @scheme ||= (@uri && _uri.scheme) || @scheme_default || S_TCP end S_TCP = 'tcp'.freeze def host @host ||= (@uri && _uri.host) || @host_default || S_LOCALHOST end S_LOCALHOST = '127.0.0.1'.freeze def port @port ||= (@uri && _uri.port) || @port_default || (raise Error, "#{self.class}: port not set.") end def path @path ||= (@uri && _uri.path) || @path_default end end end
Version data entries
13 entries across 13 versions & 1 rubygems