class Build::URI::Absolute

Constants

PARSER

A subset of RFC2396 specifically relevant to path based URIs. We are not interested in generic URIs such as mailto.

Public Class Methods

parse(string) click to toggle source
# File lib/build/uri/absolute.rb, line 80
def self.parse(string)
        if match = PARSER.match(string)
                self.new(
                        match[:scheme], match[:userinfo], match[:host], match[:path], match[:query], match[:fragment]
                ).freeze
        end
end

Public Instance Methods

absolute?() click to toggle source
# File lib/build/uri/absolute.rb, line 40
def absolute?
        true
end
local?() click to toggle source
# File lib/build/uri/absolute.rb, line 44
def local?
        false
end
to_s() click to toggle source
# File lib/build/uri/absolute.rb, line 48
def to_s
        buffer = String.new
        
        if scheme
                buffer << scheme << ':'
        end
        
        if host
                buffer << '//'
                
                if userinfo
                        buffer << userinfo << '@'
                end
                
                buffer << host
        end
        
        if path
                buffer << path
        end
        
        if query
                buffer << '?' << query
        end
        
        if fragment
                buffer << '#' << fragment
        end
        
        return buffer
end