class URI::Generic

Public Instance Methods

address_info() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1703
def address_info()
  ::Addrinfo::parse(self)
end
fragment() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1553
def fragment
        if @fragment.is_a?(String)
                URI::unescape(@fragment)
        else
                @fragment
        end
end
fragment=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1545
def fragment=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_fragment(v)
        self.fragment
end
from_hash(the_hash={}) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1601
def from_hash(the_hash={})
                    if the_hash[:scheme]
    self.scheme = the_hash[:scheme]
  else
    @scheme = nil
                    end
                    if the_hash[:opaque]
    self.opaque = the_hash[:opaque]
    @registry = nil
    @user = nil
    @password = nil
    @host = nil
    @port = nil
    @path = nil
    @query = nil
                    else
    @opaque = nil
                            if the_hash[:registry]
      self.registry = the_hash[:registry]
      @user = nil
      @password = nil
      @host = nil
      @port = nil
                            else
      @registry = nil
      if the_hash[:user]
        self.user = the_hash[:user]
      else
        @user = nil
      end
      if the_hash[:password]
        self.password = the_hash[:password]
      else
        @password = nil
      end
      if the_hash[:host]
        self.host = the_hash[:host]
      else
        @host = nil
      end
      if the_hash[:port] && the_hash[:port] != self.default_port
        self.port = the_hash[:port].to_i
      else
        @port = nil
      end
                            end
    if the_hash[:path]
      self.path = the_hash[:path]
    else
      @path = nil
    end
    if the_hash[:query]
      self.query = the_hash[:query]
    else
      @query = nil
    end
                    end
  if the_hash[:fragment]
    self.fragment = the_hash[:fragment]
  else
    @fragment = nil
  end
  self
end
host() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1411
def host()
        if @host.is_a?(String)
                URI::unescape(@host)
        else
                @host
        end
end
host=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1403
def host=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_host(v)
        self.host
end
hostname() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1419
def hostname()
  if @host.to_s.size > 0
    self.host().to_s.dup.gsub("[","").gsub("]","")
  else
    nil
  end
end
hostname=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1427
def hostname=(v)
  if (v.to_s.include?(":") || (v.to_s.include?("[") && v.to_s.include?("]")))
    # ipv6 ??
    if v.to_s.include?("[") && v.to_s.include?("]")
      self.host = v.to_s
    else
      self.host = "[" << v.to_s << "]"
    end
  else
    self.host = v.to_s
  end
  self.host()
end
opaque() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1505
def opaque
        if @opaque.is_a?(String)
                URI::unescape(@opaque)
        else
                @opaque
        end
end
opaque=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1497
def opaque=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_opaque(v)
        self.opaque
end
password() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1387
def password
        if @password.is_a?(String)
                URI::unescape(@password)
        else
                @password
        end
end
password=(password) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1379
def password=(password)
        if password.is_a?(String)
                password = (URI::escape(password))
        end
        set_password(password)
        # returns password
end
path() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1481
def path
        if @path.is_a?(String)
                URI::unescape(@path)
        else
                @path
        end
end
path=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1473
def path=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_path(v)
        self.path
end
query() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1529
def query
        if @query.is_a?(String)
                URI::unescape(@query)
        else
                @query
        end
end
query=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1521
def query=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_query(v)
        self.query
end
registry() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1457
def registry
        if @registry.is_a?(String)
                URI::unescape(@registry)
        else
                @registry
        end
end
registry=(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1449
def registry=(v)
        if v.is_a?(String)
                v = (URI::escape(v))
        end
        set_registry(v)
        self.registry
end
resolve_host() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1707
def resolve_host()
  case @scheme
  when "inproc"
    # no-op
  when "ipc", "unix"
    # no-op
  when "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6"
    self.hostname = ::TCPSocket.getaddress(self.hostname)
  end
end
scheme() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1309
          def scheme()
@scheme
          end
scheme=(scheme="") click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1304
def scheme=(scheme="")
        set_scheme(scheme)
        scheme
end
set_fragment(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1537
def set_fragment(v)
        if v.is_a?(String)
                @fragment = URI::escape(v)
        else
                @fragment = v
        end
end
set_host(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1395
def set_host(v)
        if v.is_a?(String)
                @host = URI::escape(v)
        else
                @host = v
        end
end
set_opaque(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1489
def set_opaque(v)
        if v.is_a?(String)
                @opaque = URI::escape(v)
        else
                @opaque = v
        end
end
set_password(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1368
def set_password(v)
        if v.is_a?(String)
                @password = URI::escape(v)
        end
        if @password.is_a?(String)
                URI::unescape(@password)
        else
                @password
        end
end
set_path(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1465
def set_path(v)
        if v.is_a?(String)
                @path = URI::escape(v)
        else
                @path = v
        end
end
set_query(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1513
def set_query(v)
        if v.is_a?(String)
                @query = URI::escape(v)
        else
                @query = v
        end
end
set_registry(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1441
def set_registry(v)
        if v.is_a?(String)
                @registry = URI::escape(v)
        else
                @registry = v
        end
end
set_scheme(v) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1297
          def set_scheme(v)
                  if v.is_a?(String)
  @scheme = v
                  end
v
          end
set_userinfo(user, password = nil) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1313
def set_userinfo(user, password = nil)
        unless password 
                user, password = split_userinfo(user)
        end
        if user.is_a?(String)
                @user     = URI::escape(user)
        else
                @user = user
        end
        if password.is_a?(String)
                @password = URI::escape(password)
        else
                @password = password
        end
        result = []
        if @user.is_a?(String)
                result << URI::unescape(@user)
        else
                result << @user
        end
        if @password.is_a?(String)
                result << URI::unescape(@password)
        else
                result << @password
        end
        result
end
to_hash() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1666
          def to_hash()
                  result = {}
                  if @scheme
                          result[:scheme] = @scheme
                  end
                  if @opaque
                          result[:opaque] = URI::unescape(@opaque)
                  else
                          if @registry
    result[:registry] = URI::unescape(@registry)
                          else
    if @user
      result[:user] = URI::unescape(@user)
    end
    if @password
      result[:password] = URI::unescape(@password)
    end
    if @host
      result[:host] = URI::unescape(@host)
    end
    if @port && @port != self.default_port
      result[:port] = URI::unescape(@port).to_i
    end
                          end
  if @path
    result[:path] = URI::unescape(@path)
  end
  if @query
    result[:query] = URI::unescape(@query)
  end
                  end
if @fragment
  result[:fragment] = URI::unescape(@fragment)
end
result
          end
to_s() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1561
        def to_s
                str = ''
                if @scheme
                        str << @scheme
                        str << ':'
                end
                if @opaque
                        str << @opaque
                else
                        if @registry
                                str << @registry
                        else
  if @host
    str << '//'
  end
  if self.userinfo
    str << self.userinfo
    str << '@'
  end
  if @host
    str << @host
  end
  if @port && @port != self.default_port
    str << ':'
    str << @port.to_s
  end
                        end
str << @path
if @query
  str << '?'
  str << @query
end
                end
                if @fragment
                        str << '#'
                        str << @fragment
                end
                URI::escape(str)
        end
user() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1360
def user
        if @user.is_a?(String)
                URI::unescape(@user)
        else
                @user
        end
end
user=(user) click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1351
def user=(user)
        if user.is_a?(String)
                user = (URI::escape(user))
        end
        set_user(user)
        self.user
        # returns user
end
userinfo() click to toggle source
# File lib/gxg/gxg_augmented.rb, line 1341
def userinfo
        if @user.nil?
                nil
        elsif @password.nil?
                URI::unescape(@user)
        else
                URI::unescape(@user) + ':' + URI::unescape(@password)
        end
end