Method: Condenser::BabelProcessor#split_subpath

Defined in:
lib/condenser/processors/babel_processor.rb

#split_subpath(path, subpath) ⇒ Object

Internal: Get relative path for root path and subpath.

path - String path subpath - String subpath of path

Returns relative String path if subpath is a subpath of path, or nil if subpath is outside of path.



156
157
158
159
160
161
162
163
164
# File 'lib/condenser/processors/babel_processor.rb', line 156

def split_subpath(path, subpath)
  return "" if path == subpath
  path = File.join(path, ''.freeze)
  if subpath.start_with?(path)
    subpath[path.length..-1]
  else
    nil
  end
end