Class: ActiveRecordQueryCounter::Thresholds
- Inherits:
-
Object
- Object
- ActiveRecordQueryCounter::Thresholds
- Defined in:
- lib/active_record_query_counter/thresholds.rb
Overview
Thresholds for sending notifications based on query time, row count, transaction time, and transaction count.
Instance Attribute Summary collapse
-
#query_time ⇒ Object
Returns the value of attribute query_time.
-
#row_count ⇒ Object
Returns the value of attribute row_count.
-
#transaction_count ⇒ Object
Returns the value of attribute transaction_count.
-
#transaction_time ⇒ Object
Returns the value of attribute transaction_time.
Instance Method Summary collapse
-
#clear ⇒ Object
Clear all threshold values.
-
#set(values) ⇒ void
Set threshold values from a hash.
Instance Attribute Details
#query_time ⇒ Object
Returns the value of attribute query_time.
7 8 9 |
# File 'lib/active_record_query_counter/thresholds.rb', line 7 def query_time @query_time end |
#row_count ⇒ Object
Returns the value of attribute row_count.
7 8 9 |
# File 'lib/active_record_query_counter/thresholds.rb', line 7 def row_count @row_count end |
#transaction_count ⇒ Object
Returns the value of attribute transaction_count.
7 8 9 |
# File 'lib/active_record_query_counter/thresholds.rb', line 7 def transaction_count @transaction_count end |
#transaction_time ⇒ Object
Returns the value of attribute transaction_time.
7 8 9 |
# File 'lib/active_record_query_counter/thresholds.rb', line 7 def transaction_time @transaction_time end |
Instance Method Details
#clear ⇒ Object
Clear all threshold values.
41 42 43 44 45 46 |
# File 'lib/active_record_query_counter/thresholds.rb', line 41 def clear @query_time = nil @row_count = nil @transaction_time = nil @transaction_count = nil end |
#set(values) ⇒ void
This method returns an undefined value.
Set threshold values from a hash.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active_record_query_counter/thresholds.rb', line 29 def set(values) values.each do |key, value| setter = "#{key}=" if respond_to?(setter) public_send("#{key}=", value) else raise ArgumentError, "Unknown threshold: #{key}" end end end |