Module: LcpRuby::PathUtils

Defined in:
lib/lcp_ruby/path_utils.rb

Class Method Summary collapse

Class Method Details

.relative_path(file_path) ⇒ Object



5
6
7
8
9
10
# File 'lib/lcp_ruby/path_utils.rb', line 5

def self.relative_path(file_path)
  return nil unless file_path
  return file_path.to_s unless defined?(Rails) && Rails.respond_to?(:root) && Rails.root

  Pathname.new(file_path).relative_path_from(Rails.root).to_s
end