Class: Reportinator::Parser

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

Direct Known Subclasses

MethodParser, ReportParser, ValueParser

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

config, #config, logger, #logger

Methods included from Helpers

#merge_hash, #merge_hash!, #symbolize_attributes

Class Method Details

.get_prefix_listObject



5
6
7
# File 'lib/reportinator/parser.rb', line 5

def self.get_prefix_list
  config.configured_functions.map { |function| function::PREFIXES }.flatten
end

.prefix_listObject



9
10
11
# File 'lib/reportinator/parser.rb', line 9

def self.prefix_list
  @prefix_list ||= get_prefix_list
end

Instance Method Details

#escape_value(value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/reportinator/parser.rb', line 17

def escape_value(value)
  return value unless value.is_a? String
  prefix_list.each do |escape|
    return value.prepend("?/") if value.strip.start_with?(escape)
  end
  value
end

#prefix_listObject



13
14
15
# File 'lib/reportinator/parser.rb', line 13

def prefix_list
  self.class.prefix_list
end