| Module | Launchy::Paths |
| In: |
lib/launchy/paths.rb
lib/launchy/paths.rb |
Access to various paths inside the project programatically
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
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
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
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
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
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