Class: Pansophy::Helpers::PathBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pansophy/helpers/path_builder.rb

Instance Method Summary collapse

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_pathObject



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