Module: RequestLogAnalyzer

Defined in:
lib/request_log_analyzer.rb,
lib/request_log_analyzer/mailer.rb,
lib/request_log_analyzer/request.rb,
lib/request_log_analyzer/version.rb,
lib/request_log_analyzer/controller.rb,
lib/request_log_analyzer/log_processor.rb,
lib/request_log_analyzer/line_definition.rb,
lib/request_log_analyzer/class_level_inheritable_attributes.rb

Overview

RequestLogAnalyzer is the base namespace in which all functionality of RequestLogAnalyzer is implemented. This module itself contains some functions to help with class and source file loading. The actual application startup code resides in the Controller class.

The VERSION constant can be used to determine what version of request-log-analyzer is running.

Defined Under Namespace

Modules: Aggregator, ClassLevelInheritableAttributes, FileFormat, Filter, Output, Source, Tracker Classes: Controller, Database, LineDefinition, LogProcessor, Mailer, Request

Constant Summary collapse

VERSION =
'1.13.4'

Class Method Summary collapse

Class Method Details

.to_camelcase(str) ⇒ String

Convert a string/symbol in underscores (request_log_analyzer/controller) to camelcase (Controller). This can be used to find the class that is defined in a given filename.

Parameters:

  • str (#to_s)

    The string-like to convert in the f`ollowing format: module_name/class_name.

Returns:

  • (String)

    The input string converted to camelcase form.



26
27
28
# File 'lib/request_log_analyzer.rb', line 26

def self.to_camelcase(str)
  str.to_s.gsub(/\/(.?)/) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
end

.to_underscore(str) ⇒ String

Convert a string/symbol in camel case (Controller) to underscores (request_log_analyzer/controller). This function can be used to load the file (using require) in which the given constant is defined.

Parameters:

  • str (#to_s)

    The string-like to convert in the following format: ModuleName::ClassName.

Returns:

  • (String)

    The input string converted to underscore form.



16
17
18
# File 'lib/request_log_analyzer.rb', line 16

def self.to_underscore(str)
  str.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr('-', '_').downcase
end