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.



14
15
16
# File 'lib/active_record/connection_adapters/sqlserver/showplan/printer_table.rb', line 14

def initialize(result)
  @result = result
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



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

def result
  @result
end

Instance Method Details

#ppObject



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

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