Class: ActiveRecord::ConnectionAdapters::SQLServer::Showplan::PrinterTable

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ PrinterTable

Returns a new instance of PrinterTable.



12
13
14
# File 'lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb', line 12

def initialize(result)
  @result = result
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



10
11
12
# File 'lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb', line 10

def result
  @result
end

Instance Method Details

#ppObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb', line 16

def pp
  @widths = compute_column_widths
  @separator = build_separator
  pp = []
  pp << @separator
  pp << build_cells(result.columns)
  pp << @separator
  result.rows.each do |row|
    pp << build_cells(row)
  end
  pp << @separator
  pp.join("\n") + "\n"
end