module RequestLogAnalyzer

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 {RequestLogAnalyzer::Controller} class.

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

Constants

VERSION

Public Class Methods

to_camelcase(str) click to toggle source

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

@param [#to_s] str The string-like to convert in the f`ollowing format: module_name/class_name. @return [String] The input string converted to camelcase form.

   # File lib/request_log_analyzer.rb
26 def self.to_camelcase(str)
27   str.to_s.gsub(/\/(.?)/) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
28 end
to_underscore(str) click to toggle source

Convert a string/symbol in camel case ({RequestLogAnalyzer::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.

@param [#to_s] str The string-like to convert in the following format: ModuleName::ClassName. @return [String] The input string converted to underscore form.

   # File lib/request_log_analyzer.rb
16 def self.to_underscore(str)
17   str.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr('-', '_').downcase
18 end