Launchy::Paths

Access to various paths inside the project programatically

Public Class Methods

lib_path( *args ) → String click to toggle source

Returns The full expanded path of the lib directory below root_dir. All parameters passed in are joined onto the⋅ result. A trailing File::SEPARATOR is guaranteed if⋅ args are not present.

    # File lib/launchy/paths.rb, line 36
36:     def self.lib_path( *args )
37:       self.sub_path( "lib", *args )
38:     end
root_dir → String click to toggle source

Returns The full expanded path of the parent directory of lib going up the path from the current file. A trailing File::SEPARATOR⋅ is guaranteed

    # File lib/launchy/paths.rb, line 19
19:     def self.root_dir
20:       @root_dir ||=(
21:         path_parts = ::File.expand_path( __FILE__ ).split( ::File::SEPARATOR )
22:         lib_index  = path_parts.rindex( "lib" )
23:         @root_dir  = path_parts[0...lib_index].join( ::File::SEPARATOR ) + ::File::SEPARATOR
24:       )
25:     end
sub_path( sub, *args ) → String click to toggle source

Returns the full expanded path of the sub directory below _root_dir. All arg parameters passed in are joined onto the result. A trailing File::SEPARATOR is guaranteed if args are not present.

    # File lib/launchy/paths.rb, line 48
48:     def self.sub_path( sub, *args )
49:       sp = ::File.join( root_dir, sub ) + File::SEPARATOR
50:       sp = ::File.join( sp, *args ) if args
51:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.