Class: Capybara::Lightpanda::Logger
- Inherits:
-
Object
- Object
- Capybara::Lightpanda::Logger
- Defined in:
- lib/capybara/lightpanda/logger.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #elapsed_time ⇒ Object
-
#initialize(output = nil) ⇒ Logger
constructor
A new instance of Logger.
- #puts(message) ⇒ Object
- #suppress ⇒ Object
- #suppressed? ⇒ Boolean
Constructor Details
#initialize(output = nil) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 12 |
# File 'lib/capybara/lightpanda/logger.rb', line 8 def initialize(output = nil) @output = output @suppressed = false @started_at = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/capybara/lightpanda/logger.rb', line 6 def output @output end |
Instance Method Details
#elapsed_time ⇒ Object
32 33 34 |
# File 'lib/capybara/lightpanda/logger.rb', line 32 def elapsed_time format("%.3fs", ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - @started_at) end |
#puts(message) ⇒ Object
14 15 16 17 18 |
# File 'lib/capybara/lightpanda/logger.rb', line 14 def puts() return if @suppressed || @output.nil? @output.puts() end |
#suppress ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/capybara/lightpanda/logger.rb', line 20 def suppress prev = @suppressed @suppressed = true yield ensure @suppressed = prev end |
#suppressed? ⇒ Boolean
28 29 30 |
# File 'lib/capybara/lightpanda/logger.rb', line 28 def suppressed? @suppressed end |