Class: Alt::URI::File
Instance Attribute Summary
Attributes inherited from Base
#ext, #parts
Instance Method Summary
collapse
Methods included from Builders
create, create_, parse, parse_
#[], #[]=, #abs, #absolute?, #join, #rel, #relative?, #route_from, #route_to
Methods inherited from Base
#==, #length, #sub
Methods included from RIO::Fwd
#fwd, #fwd_reader, #fwd_readers, #fwd_writer, #fwd_writers
#basename, #basename=, #dirname, #dirname=, #extname, #extname=, #filename, #filename=
Constructor Details
#initialize(parts = nil) ⇒ File
Returns a new instance of File.
214
215
216
217
218
219
|
# File 'lib/rio/alturi.rb', line 214
def initialize(parts=nil)
prts = parts || Alt::URI::Gen::URIParts.new
prts.scheme ||= 'file'
prts.host ||= ""
super(prts)
end
|
Instance Method Details
#authority=(val) ⇒ Object
247
248
249
|
# File 'lib/rio/alturi.rb', line 247
def authority=(val)
self.host = val
end
|
238
239
240
|
# File 'lib/rio/alturi.rb', line 238
def fspath
normalize.netpath
end
|
#fspath=(val) ⇒ Object
241
|
# File 'lib/rio/alturi.rb', line 241
def fspath=(val) netpath = val end
|
#host=(val) ⇒ Object
243
244
245
|
# File 'lib/rio/alturi.rb', line 243
def host=(val)
parts.host = (val || "")
end
|
#initialize_copy(other) ⇒ Object
220
221
222
|
# File 'lib/rio/alturi.rb', line 220
def initialize_copy(other)
super
end
|
235
236
237
|
# File 'lib/rio/alturi.rb', line 235
def netpath
parts.netpath
end
|
#normalize ⇒ Object
231
232
233
234
|
# File 'lib/rio/alturi.rb', line 231
def normalize
hst = self.host if self.host and !(self.host == 'localhost' or self.host.empty?)
::Alt::URI.create(:host => hst, :path => self.path)
end
|
259
260
261
|
# File 'lib/rio/alturi.rb', line 259
def path
parts.path.sub(Regexp.new(%{^/([a-zA-Z]:)}),'\1')
end
|
#path=(val) ⇒ Object
255
256
257
|
# File 'lib/rio/alturi.rb', line 255
def path=(val)
parts.path = val.nil? ? val : val.sub(Regexp.new(%{^([a-zA-Z]:)}),'/\1')
end
|
#scheme=(val) ⇒ Object
251
252
253
|
# File 'lib/rio/alturi.rb', line 251
def scheme=(val)
parts.scheme = (val || 'file')
end
|
#uri=(val) ⇒ Object
263
264
265
266
267
|
# File 'lib/rio/alturi.rb', line 263
def uri=(val)
parts.uri = val
self.scheme ||=nil
self.host ||=nil
end
|