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.
-
#initialize ⇒ Thresholds
constructor
A new instance of Thresholds.
-
#set(values) ⇒ void
Set threshold values from a hash.
Constructor Details
#initialize ⇒ Thresholds
Returns a new instance of Thresholds.
9 10 11 |
# File 'lib/active_record_query_counter/thresholds.rb', line 9 def initialize clear end |
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.
45 46 47 48 49 50 |
# File 'lib/active_record_query_counter/thresholds.rb', line 45 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.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/active_record_query_counter/thresholds.rb', line 33 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 |