Class: Alt::URI::Gen::URIString

Inherits:
Base show all
Defined in:
lib/rio/alturi/uri_parts.rb

Instance Method Summary collapse

Methods inherited from Base

#_do_esc, #_do_unesc, #nil_or

Constructor Details

#initialize(scheme, authority, path, query, fragment) ⇒ URIString

Returns a new instance of URIString.



67
68
69
70
71
72
73
# File 'lib/rio/alturi/uri_parts.rb', line 67

def initialize(scheme,authority,path,query,fragment)
  @scheme = scheme
  @authority = authority
  @path = path
  @query = query
  @fragment = fragment
end

Instance Method Details

#authorityObject



79
80
81
# File 'lib/rio/alturi/uri_parts.rb', line 79

def authority
  '//' + @authority if @authority
end

#fragmentObject



94
95
96
# File 'lib/rio/alturi/uri_parts.rb', line 94

def fragment
  '#' + @fragment if @fragment
end

#pathObject



83
84
85
86
87
88
# File 'lib/rio/alturi/uri_parts.rb', line 83

def path 
  (@authority && 
   @authority.empty? && 
   !@path.empty? && 
   !@path.start_with?("/") ? "/" : "") + @path
end

#queryObject



90
91
92
# File 'lib/rio/alturi/uri_parts.rb', line 90

def query
  '?' + @query if @query
end

#schemeObject



75
76
77
# File 'lib/rio/alturi/uri_parts.rb', line 75

def scheme
  @scheme + ':' if @scheme
end

#to_sObject



98
99
100
101
102
103
# File 'lib/rio/alturi/uri_parts.rb', line 98

def to_s
  str = "#{scheme}#{authority}#{path}#{query}#{fragment}"
  #p "Alt::URI::Gen::URIString"
  #p str
  str
end