Class: ARQLogger::Log
- Inherits:
-
Object
- Object
- ARQLogger::Log
- Defined in:
- lib/a_r_q_logger.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#instances ⇒ Object
Returns the value of attribute instances.
-
#queries ⇒ Object
Returns the value of attribute queries.
-
#start_at ⇒ Object
Returns the value of attribute start_at.
Instance Method Summary collapse
- #count ⇒ Object
- #finish(end_at) ⇒ Object
-
#initialize(start_at:) ⇒ Log
constructor
A new instance of Log.
- #instantiate ⇒ Object
- #push(query) ⇒ Object
- #queries_time ⇒ Object
Constructor Details
#initialize(start_at:) ⇒ Log
Returns a new instance of Log.
58 59 60 61 62 63 |
# File 'lib/a_r_q_logger.rb', line 58 def initialize(start_at:) @start_at = start_at @queries = [] @instances = 0 end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
56 57 58 |
# File 'lib/a_r_q_logger.rb', line 56 def duration @duration end |
#instances ⇒ Object
Returns the value of attribute instances.
56 57 58 |
# File 'lib/a_r_q_logger.rb', line 56 def instances @instances end |
#queries ⇒ Object
Returns the value of attribute queries.
56 57 58 |
# File 'lib/a_r_q_logger.rb', line 56 def queries @queries end |
#start_at ⇒ Object
Returns the value of attribute start_at.
56 57 58 |
# File 'lib/a_r_q_logger.rb', line 56 def start_at @start_at end |
Instance Method Details
#count ⇒ Object
77 78 79 |
# File 'lib/a_r_q_logger.rb', line 77 def count @queries.size end |
#finish(end_at) ⇒ Object
65 66 67 |
# File 'lib/a_r_q_logger.rb', line 65 def finish(end_at) @duration = end_at - start_at end |
#instantiate ⇒ Object
69 70 71 |
# File 'lib/a_r_q_logger.rb', line 69 def instantiate @instances += 1 end |
#push(query) ⇒ Object
73 74 75 |
# File 'lib/a_r_q_logger.rb', line 73 def push(query) @queries.push(query) end |
#queries_time ⇒ Object
81 82 83 |
# File 'lib/a_r_q_logger.rb', line 81 def queries_time @queries.sum.round(1) end |