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!, #line_type, subclass_from_line_definition, subclass_from_table

Class Method Details

.create_table!Object

Creates the table to store requests in.



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

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.



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

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