Class: Bibliothecary::Parsers::Julia

Inherits:
Object
  • Object
show all
Includes:
Analyser
Defined in:
lib/bibliothecary/parsers/julia.rb

Class Method Summary collapse

Methods included from Analyser

included

Class Method Details

.parse(filename, path) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/bibliothecary/parsers/julia.rb', line 6

def self.parse(filename, path)
  if filename.match(/^REQUIRE$/i)
    file_contents = File.open(path).read
    parse_require(file_contents)
  else
    []
  end
end

.parse_require(manifest) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/bibliothecary/parsers/julia.rb', line 15

def self.parse_require(manifest)
  manifest.split("\n").map do |line|
    match = line.split(/\s/)
    {
      name: match[0],
      requirement: match[1] || '*',
      type: 'runtime'
    }
  end
end