Class: ARQLogger::Log

Inherits:
Object
  • Object
show all
Defined in:
lib/a_r_q_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#durationObject

Returns the value of attribute duration.



56
57
58
# File 'lib/a_r_q_logger.rb', line 56

def duration
  @duration
end

#instancesObject

Returns the value of attribute instances.



56
57
58
# File 'lib/a_r_q_logger.rb', line 56

def instances
  @instances
end

#queriesObject

Returns the value of attribute queries.



56
57
58
# File 'lib/a_r_q_logger.rb', line 56

def queries
  @queries
end

#start_atObject

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

#countObject



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

#instantiateObject



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_timeObject



81
82
83
# File 'lib/a_r_q_logger.rb', line 81

def queries_time
  @queries.sum.round(1)
end