Class: Rack::DevInsight::Result::Sql::Queries

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/dev_insight/result/sql/queries.rb

Defined Under Namespace

Classes: Query, TraceInfo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQueries

Returns a new instance of Queries.



13
14
15
16
# File 'lib/rack/dev_insight/result/sql/queries.rb', line 13

def initialize
  @id = 0
  @data = []
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/rack/dev_insight/result/sql/queries.rb', line 11

def id
  @id
end

Instance Method Details

#add(statement, binds, backtrace, duration) ⇒ Object



18
19
20
# File 'lib/rack/dev_insight/result/sql/queries.rb', line 18

def add(statement, binds, backtrace, duration)
  @data << Query.new(@id += 1, statement, binds, backtrace.map(&:to_h), duration)
end

#attributesObject



22
23
24
# File 'lib/rack/dev_insight/result/sql/queries.rb', line 22

def attributes
  @data.map(&:to_h)
end