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
#authority ⇒ Object
79
80
81
|
# File 'lib/rio/alturi/uri_parts.rb', line 79
def authority
'//' + @authority if @authority
end
|
94
95
96
|
# File 'lib/rio/alturi/uri_parts.rb', line 94
def fragment
'#' + @fragment if @fragment
end
|
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
|
90
91
92
|
# File 'lib/rio/alturi/uri_parts.rb', line 90
def query
'?' + @query if @query
end
|
75
76
77
|
# File 'lib/rio/alturi/uri_parts.rb', line 75
def scheme
@scheme + ':' if @scheme
end
|
98
99
100
101
102
103
|
# File 'lib/rio/alturi/uri_parts.rb', line 98
def to_s
str = "#{scheme}#{authority}#{path}#{query}#{fragment}"
str
end
|