Class: RequestLogAnalyzer::FileFormat::RailsDevelopment::Request

Inherits:
RequestLogAnalyzer::FileFormat::Rails::Request show all
Defined in:
lib/request_log_analyzer/file_format/rails_development.rb

Overview

Add a converter method for the SQL fields the the Rails request class

Instance Attribute Summary

Attributes inherited from Request

#attributes, #file_format, #lines

Instance Method Summary collapse

Methods inherited from RequestLogAnalyzer::FileFormat::Rails::Request

#convert_timestamp

Methods inherited from Request

#<<, #add_line_hash, #add_parsed_line, #completed?, create, #empty?, #every, #first, #first_lineno, #has_line_type?, #initialize, #last_lineno, #timestamp, #validate

Methods included from Request::Converters

#convert_decimal, #convert_duration, #convert_eval, #convert_float, #convert_int, #convert_integer, #convert_string, #convert_sym, #convert_symbol, #convert_timestamp, #convert_traffic, #convert_value

Constructor Details

This class inherits a constructor from RequestLogAnalyzer::Request

Instance Method Details

#convert_sql(sql, definition) ⇒ Object

Sanitizes SQL queries so that they can be grouped



52
53
54
# File 'lib/request_log_analyzer/file_format/rails_development.rb', line 52

def convert_sql(sql, definition) 
  sql.gsub(/\b\d+\b/, ':int').gsub(/`([^`]+)`/, '\1').gsub(/'[^']*'/, ':string').rstrip
end