Module: Alt::URI::Builders

Included in:
FTP, File, Generic, HTTP
Defined in:
lib/rio/alturi.rb

Instance Method Summary collapse

Instance Method Details

#create(hash = nil) ⇒ Object



28
29
30
31
# File 'lib/rio/alturi.rb', line 28

def create(hash=nil)
  hash ||= Hash.new
  create_(hash)
end

#create_(hash) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/rio/alturi.rb', line 19

def create_(hash)
  u = self.new
  hash.each do |k,v|
    sym = (k.to_s+?=).to_sym
    u.__send__(sym,v)
  end
  u
end

#parse(str) ⇒ Object



15
16
17
# File 'lib/rio/alturi.rb', line 15

def parse(str)
  parse_(str)
end

#parse_(str) {|u| ... } ⇒ Object

Yields:

  • (u)


8
9
10
11
12
13
# File 'lib/rio/alturi.rb', line 8

def parse_(str,&block)
  u = self.new
  u.uri = str
  yield u if block_given?
  u
end