Class: URI::FILE

Inherits:
Generic show all
Defined in:
lib/rio/uri/file.rb

Overview

module REGEXP

Constant Summary collapse

COMPONENT =

ABS_FILE_PATH = REGEXP::ABS_FILE_PATH

[
  :scheme, 
  :host,
  :path, 
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*arg) ⇒ FILE

Description

Create a new URI::FILE object from “generic” components with no check.



174
175
176
177
# File 'lib/rio/uri/file.rb', line 174

def initialize(*arg)
  super(*arg)
  self.host = '' if self.host.nil?
end

Class Method Details

.build(args) ⇒ Object

Description

Create a new URI::FILE object from components of URI::FILE with check. It is scheme, userinfo, host, port, path, query and fragment. It provided by an Array of a Hash.



162
163
164
165
166
# File 'lib/rio/uri/file.rb', line 162

def self.build(args)
  #p "In build: "+args.inspect
  tmp = Util::make_components_hash(self, args)
  return super(tmp)
end

Instance Method Details

#file(*args) ⇒ Object



149
150
151
152
153
# File 'lib/rio/uri/file.rb', line 149

def file(*args)
  pth = self.path(*args)
  pth.chop! if pth[-1,1] == '/' && pth != '/'
  return pth
end

#normalize!Object



142
143
144
145
146
147
# File 'lib/rio/uri/file.rb', line 142

def normalize!
  super
  if host && host == 'localhost'
    set_host('')
  end
end

#path=(v) ⇒ Object



135
136
137
138
139
140
# File 'lib/rio/uri/file.rb', line 135

def path=(v)
  #p "self=#{self} v=#{v}"
  check_path(v)
  set_path(v)
  v
end