Class: RSpec::Buildkite::Analytics::Session::Logger
- Inherits:
-
Object
- Object
- RSpec::Buildkite::Analytics::Session::Logger
- Defined in:
- lib/rspec/buildkite/analytics/session.rb
Instance Method Summary collapse
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #to_array ⇒ Object
- #write(str) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
16 17 18 |
# File 'lib/rspec/buildkite/analytics/session.rb', line 16 def initialize @log = Queue.new end |
Instance Method Details
#to_array ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec/buildkite/analytics/session.rb', line 24 def to_array # This empty check is important cos calling pop on a Queue is blocking until # it's not empty if @log.empty? [] else Array.new(@log.size) { @log.pop } end end |
#write(str) ⇒ Object
20 21 22 |
# File 'lib/rspec/buildkite/analytics/session.rb', line 20 def write(str) @log << "#{Time.now.strftime("%F-%R:%S.%9N")} #{Thread.current} #{str}" end |