Class: Deadfire::FilenameHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/deadfire/filename_helper.rb

Class Method Summary collapse

Class Method Details

.normalize_path(line) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/deadfire/filename_helper.rb', line 18

def normalize_path(line)
  path = line.split.last
  path.gsub!("\"", "")
  path.gsub!("\'", "")
  path.gsub!(";", "")
  path
end

.resolve_import_path(line, lineno = 0) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/deadfire/filename_helper.rb', line 6

def resolve_import_path(line, lineno = 0)
  path = normalize_path(line)
  potential = potential_path(path)
  ext = File.extname(path)

  if ext && valid_file?(potential)
    potential
  else
    possible_paths(path)
  end
end