Class: Pansophy::Helpers::PathBuilder
- Inherits:
-
Object
- Object
- Pansophy::Helpers::PathBuilder
- Defined in:
- lib/pansophy/helpers/path_builder.rb
Instance Method Summary collapse
-
#initialize(file, directory) ⇒ PathBuilder
constructor
A new instance of PathBuilder.
- #relative_path ⇒ Object
Constructor Details
#initialize(file, directory) ⇒ PathBuilder
Returns a new instance of PathBuilder.
4 5 6 7 |
# File 'lib/pansophy/helpers/path_builder.rb', line 4 def initialize(file, directory) @file = file @directory = directory end |
Instance Method Details
#relative_path ⇒ Object
9 10 11 12 |
# File 'lib/pansophy/helpers/path_builder.rb', line 9 def relative_path return @file.pathname if @directory.pathname.to_s.empty? @file.pathname.sub(::File.join(@directory.pathname, '/'), '') end |