Module: Roda::DebugBar::Current
Instance Method Summary collapse
-
#accrued_database_time ⇒ Numeric
The accrued database time.
-
#accrued_database_time=(value) ⇒ Numeric
Set accrued database time.
- #add_database_query(message, duration) ⇒ Object
- #add_model(model, values) ⇒ Object
- #add_route(handler, path) ⇒ Object
- #add_view(view) ⇒ Object
- #database_queries ⇒ Object
- #database_queries=(value) ⇒ Object
- #database_query_count ⇒ Object
- #database_query_count=(value) ⇒ Object
-
#increment_accrued_database_time(value) ⇒ Numeric
Increment the accrued database time.
- #increment_database_query_count(value = 1) ⇒ Object
- #models ⇒ Object
- #models=(value) ⇒ Object
-
#reset ⇒ Object
Reset the counters.
- #routes ⇒ Object
- #routes=(value) ⇒ Object
- #views ⇒ Object
- #views=(value) ⇒ Object
Instance Method Details
#accrued_database_time ⇒ Numeric
The accrued database time
18 19 20 |
# File 'lib/roda/debug_bar/current.rb', line 18 def accrued_database_time Thread.current[:accrued_database_time] end |
#accrued_database_time=(value) ⇒ Numeric
Set accrued database time
27 28 29 |
# File 'lib/roda/debug_bar/current.rb', line 27 def accrued_database_time=(value) Thread.current[:accrued_database_time] = value end |
#add_database_query(message, duration) ⇒ Object
44 45 46 47 |
# File 'lib/roda/debug_bar/current.rb', line 44 def add_database_query(, duration) Thread.current[:database_queries] ||= [] Thread.current[:database_queries] << {query: , duration: duration} end |
#add_model(model, values) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/roda/debug_bar/current.rb', line 57 def add_model(model, values) Thread.current[:models] ||= {} Thread.current[:models][model.to_s] ||= [] Thread.current[:models][model.to_s] << values # Thread.current[:models] << {name: model, values: values} end |
#add_route(handler, path) ⇒ Object
85 86 87 88 |
# File 'lib/roda/debug_bar/current.rb', line 85 def add_route(handler, path) Thread.current[:routes] ||= [] Thread.current[:routes] << {handler: handler, path: path} end |
#add_view(view) ⇒ Object
72 73 74 75 |
# File 'lib/roda/debug_bar/current.rb', line 72 def add_view(view) Thread.current[:view] ||= [] Thread.current[:view] << view end |
#database_queries ⇒ Object
49 50 51 |
# File 'lib/roda/debug_bar/current.rb', line 49 def database_queries Thread.current[:database_queries] end |
#database_queries=(value) ⇒ Object
53 54 55 |
# File 'lib/roda/debug_bar/current.rb', line 53 def database_queries=(value) Thread.current[:database_queries] = value end |
#database_query_count ⇒ Object
36 37 38 |
# File 'lib/roda/debug_bar/current.rb', line 36 def database_query_count Thread.current[:database_query_count] end |
#database_query_count=(value) ⇒ Object
40 41 42 |
# File 'lib/roda/debug_bar/current.rb', line 40 def database_query_count=(value) Thread.current[:database_query_count] = value end |
#increment_accrued_database_time(value) ⇒ Numeric
Increment the accrued database time
11 12 13 14 |
# File 'lib/roda/debug_bar/current.rb', line 11 def increment_accrued_database_time(value) Thread.current[:accrued_database_time] ||= 0 Thread.current[:accrued_database_time] += value end |
#increment_database_query_count(value = 1) ⇒ Object
31 32 33 34 |
# File 'lib/roda/debug_bar/current.rb', line 31 def increment_database_query_count(value = 1) Thread.current[:database_query_count] ||= 0 Thread.current[:database_query_count] += value end |
#models ⇒ Object
64 65 66 |
# File 'lib/roda/debug_bar/current.rb', line 64 def models Thread.current[:models] end |
#models=(value) ⇒ Object
68 69 70 |
# File 'lib/roda/debug_bar/current.rb', line 68 def models=(value) Thread.current[:models] = value end |
#reset ⇒ Object
Reset the counters
99 100 101 102 103 104 105 106 107 |
# File 'lib/roda/debug_bar/current.rb', line 99 def reset self.accrued_database_time = nil self.database_query_count = nil self.database_queries = nil self.models = nil self.views = nil self.routes = nil true end |
#routes ⇒ Object
90 91 92 |
# File 'lib/roda/debug_bar/current.rb', line 90 def routes Thread.current[:routes] end |
#routes=(value) ⇒ Object
94 95 96 |
# File 'lib/roda/debug_bar/current.rb', line 94 def routes=(value) Thread.current[:routes] = value end |
#views ⇒ Object
77 78 79 |
# File 'lib/roda/debug_bar/current.rb', line 77 def views Thread.current[:view] end |
#views=(value) ⇒ Object
81 82 83 |
# File 'lib/roda/debug_bar/current.rb', line 81 def views=(value) Thread.current[:view] = value end |