Module RDoc::Generator
In: generator.rb
doc-tmp/rdoc/generator.rb

Methods

gen_url   gen_url  

Public Class methods

Converts a target url to one that is relative to a given path

[Source]

    # File generator.rb, line 27
27:   def self.gen_url(path, target)
28:     from          = ::File.dirname path
29:     to, to_file   = ::File.split target
30: 
31:     from = from.split "/"
32:     to   = to.split "/"
33: 
34:     while from.size > 0 and to.size > 0 and from[0] == to[0] do
35:       from.shift
36:       to.shift
37:     end
38: 
39:     from.delete_if{|f| f =~ /^\.$/}
40:     from.fill ".."
41:     from.concat to
42:     from << to_file
43:     ::File.join(*from)
44:   end

Converts a target url to one that is relative to a given path

[Source]

    # File doc-tmp/rdoc/generator.rb, line 27
27:   def self.gen_url(path, target)
28:     from          = ::File.dirname path
29:     to, to_file   = ::File.split target
30: 
31:     from = from.split "/"
32:     to   = to.split "/"
33: 
34:     while from.size > 0 and to.size > 0 and from[0] == to[0] do
35:       from.shift
36:       to.shift
37:     end
38: 
39:     from.delete_if{|f| f =~ /^\.$/}
40:     from.fill ".."
41:     from.concat to
42:     from << to_file
43:     ::File.join(*from)
44:   end

[Validate]