Module: Bibliothecary::Analyser::ClassMethods

Defined in:
lib/bibliothecary/analyser.rb

Instance Method Summary collapse

Instance Method Details

#analyse(folder_path, file_list) ⇒ Object



11
12
13
14
15
16
# File 'lib/bibliothecary/analyser.rb', line 11

def analyse(folder_path, file_list)
  file_list.map do |path|
    filename = path.gsub(folder_path, '').gsub(/^\//, '')
    analyse_file(filename, path)
  end.compact
end

#analyse_file(filename, path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/bibliothecary/analyser.rb', line 18

def analyse_file(filename, path)
  begin
    dependencies = parse(filename, path)
    if dependencies.any?
      {
        platform: platform_name,
        path: path,
        dependencies: dependencies
      }
    else
      nil
    end
  rescue
    nil
  end
end

#platform_nameObject



7
8
9
# File 'lib/bibliothecary/analyser.rb', line 7

def platform_name
  self.name.to_s.split('::').last.downcase
end