Class: Kolekti::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/kolekti/parser.rb

Class Method Summary collapse

Class Method Details

.default_valueObject

Sometimes the parser does not generate results for some Module that other may generate. In this we case need a default value to fulfill it.

Raises:

  • (NotImplementedError)


8
# File 'lib/kolekti/parser.rb', line 8

def self.default_value; raise NotImplementedError; end

.parse(collected_metrics_hash, metric_configuration, persistence_strategy) ⇒ Object

Raises:

  • (NotImplementedError)


3
# File 'lib/kolekti/parser.rb', line 3

def self.parse(collected_metrics_hash, metric_configuration, persistence_strategy); raise NotImplementedError; end

.parse_file_name(file_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/kolekti/parser.rb', line 10

def self.parse_file_name(file_name)
  # Generates a module name by removing the file extension, replacing slashes with dots, and internal dots with underscores
  path = Pathname.new(file_name.to_s)

  path = (path.sub_ext '').to_s

  path.sub! /^\//, ''
  path.sub! /\/$/, ''
  path.gsub! '.', '_'
  path.gsub! '/', '.'

  path
end