Class: RequestLogAnalyzer::Database::Request

Inherits:
Base
  • Object
show all
Defined in:
lib/request_log_analyzer/database/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, column_type, drop_table!, #format, #format=, #line_type, subclass_from_line_definition, subclass_from_table

Class Method Details

.create_table!Object

Creates the table to store requests in.



12
13
14
15
16
17
18
19
# File 'lib/request_log_analyzer/database/request.rb', line 12

def self.create_table!
  unless database.connection.table_exists?(:requests)
    database.connection.create_table(:requests) do |t|
      t.column :first_lineno, :integer
      t.column :last_lineno,  :integer
    end
  end
end

Instance Method Details

#linesObject

Returns an array of all the Line objects of this request in the correct order.



3
4
5
6
7
8
9
# File 'lib/request_log_analyzer/database/request.rb', line 3

def lines
  @lines ||= begin
    lines = []
    self.class.reflections.each { |r, _d| lines += send(r).all }
    lines.sort
  end
end