Class: URI::FILE

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

Overview

module REGEXP

Constant Summary collapse

COMPONENT =

FILE_ABS_PATH = REGEXP::FILE_ABS_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.



191
192
193
194
# File 'lib/rio/uri/file.rb', line 191

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.



179
180
181
182
183
# File 'lib/rio/uri/file.rb', line 179

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



166
167
168
169
170
# File 'lib/rio/uri/file.rb', line 166

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

#normalize!Object



159
160
161
162
163
164
# File 'lib/rio/uri/file.rb', line 159

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

#path=(v) ⇒ Object



153
154
155
156
157
# File 'lib/rio/uri/file.rb', line 153

def path=(v)
  check_path(v)
  set_path(v)
  v
end