Class: AwesomeExplain::Insights::SqlPlansInsights
- Inherits:
-
Object
- Object
- AwesomeExplain::Insights::SqlPlansInsights
- Includes:
- Singleton
- Defined in:
- lib/awesome_explain/insights/sql_plans_insights.rb
Instance Attribute Summary collapse
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
-
#plans_stats ⇒ Object
Returns the value of attribute plans_stats.
-
#queries ⇒ Object
Returns the value of attribute queries.
Class Method Summary collapse
- .add(plan_stats) ⇒ Object
- .add_query(query) ⇒ Object
- .clear ⇒ Object
- .plans_stats ⇒ Object
- .queries ⇒ Object
Instance Method Summary collapse
- #add(plan_stats) ⇒ Object
- #add_query(query) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ SqlPlansInsights
constructor
A new instance of SqlPlansInsights.
Constructor Details
#initialize ⇒ SqlPlansInsights
Returns a new instance of SqlPlansInsights.
8 9 10 11 12 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 8 def initialize @plans_stats = [] @queries = [] @mutex = Mutex.new end |
Instance Attribute Details
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
6 7 8 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 6 def mutex @mutex end |
#plans_stats ⇒ Object
Returns the value of attribute plans_stats.
5 6 7 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 5 def plans_stats @plans_stats end |
#queries ⇒ Object
Returns the value of attribute queries.
5 6 7 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 5 def queries @queries end |
Class Method Details
.add(plan_stats) ⇒ Object
38 39 40 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 38 def self.add(plan_stats) instance.add(plan_stats) end |
.add_query(query) ⇒ Object
42 43 44 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 42 def self.add_query(query) instance.add_query(query) end |
.clear ⇒ Object
54 55 56 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 54 def self.clear instance.clear end |
.plans_stats ⇒ Object
46 47 48 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 46 def self.plans_stats instance.plans_stats end |
.queries ⇒ Object
50 51 52 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 50 def self.queries instance.queries end |
Instance Method Details
#add(plan_stats) ⇒ Object
14 15 16 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 14 def add(plan_stats) with_mutex { @plans_stats << plan_stats } end |
#add_query(query) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 18 def add_query(query) with_mutex { query = Niceql::Prettifier.prettify_sql query @queries << query } end |
#clear ⇒ Object
33 34 35 36 |
# File 'lib/awesome_explain/insights/sql_plans_insights.rb', line 33 def clear plans_stats.clear queries.clear end |