Class: Rack::DevInsight::Result::Sql
- Inherits:
-
Object
- Object
- Rack::DevInsight::Result::Sql
- Defined in:
- lib/rack/dev_insight/result/sql.rb,
lib/rack/dev_insight/result/sql/queries.rb,
lib/rack/dev_insight/result/sql/errored_queries.rb,
lib/rack/dev_insight/result/sql/crud_aggregations.rb,
lib/rack/dev_insight/result/sql/normalized_aggregations.rb
Defined Under Namespace
Classes: CrudAggregations, ErroredQueries, NormalizedAggregations, Queries
Instance Method Summary collapse
- #add(dialect, statement, binds, backtrace, duration) ⇒ Object
- #attributes ⇒ Object
-
#initialize ⇒ Sql
constructor
A new instance of Sql.
Constructor Details
#initialize ⇒ Sql
Returns a new instance of Sql.
7 8 9 10 11 12 |
# File 'lib/rack/dev_insight/result/sql.rb', line 7 def initialize @crud_aggregations = CrudAggregations.new @normalized_aggregations = NormalizedAggregations.new @errored_queries = ErroredQueries.new @queries = Queries.new end |
Instance Method Details
#add(dialect, statement, binds, backtrace, duration) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rack/dev_insight/result/sql.rb', line 14 def add(dialect, statement, binds, backtrace, duration) @queries.add(statement, binds, backtrace, duration) @crud_aggregations.add(dialect, statement, duration, @queries.id) @normalized_aggregations.add(dialect, statement, duration, @queries.id) rescue SqlInsight::Error => e @errored_queries.add(@queries.id, e., statement, backtrace, duration) end |
#attributes ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rack/dev_insight/result/sql.rb', line 22 def attributes { crud_aggregations: @crud_aggregations.attributes, normalized_aggregations: @normalized_aggregations.attributes, errored_queries: @errored_queries.attributes, queries: @queries.attributes, } end |