Module: Hitimes::Paths
- Defined in:
- lib/hitimes/paths.rb
Overview
Access to various paths inside the project programatically
Class Method Summary (collapse)
-
+ (Object) lib_path(*args)
:call-seq:.
-
+ (Object) root_dir
:call-seq:.
-
+ (Object) sub_path(sub, *args)
:call-seq:.
Class Method Details
+ (Object) lib_path(*args)
:call-seq:
Hitimes::Paths.lib_path( *args ) -> String
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.
36 37 38 |
# File 'lib/hitimes/paths.rb', line 36 def self.lib_path(*args) self.sub_path("lib", *args) end |
+ (Object) root_dir
:call-seq:
Hitimes::Paths.root_dir -> String
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.
19 20 21 22 23 24 25 |
# File 'lib/hitimes/paths.rb', line 19 def self.root_dir @root_dir ||=( path_parts = ::File.(__FILE__).split(::File::SEPARATOR) lib_index = path_parts.rindex("lib") @root_dir = path_parts[0...lib_index].join(::File::SEPARATOR) + ::File::SEPARATOR ) end |
+ (Object) sub_path(sub, *args)
:call-seq:
Hitimes::Paths.sub_path( sub, *args ) -> String
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.
48 49 50 51 |
# File 'lib/hitimes/paths.rb', line 48 def self.sub_path(sub,*args) sp = ::File.join(root_dir, sub) + File::SEPARATOR sp = ::File.join(sp, *args) if args end |