Class: Cucumber::Core::Test::Result::Duration

Inherits:
Object
  • Object
show all
Includes:
Messages::TimeConversion
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb

Constant Summary

Constants included from Messages::TimeConversion

Messages::TimeConversion::NANOSECONDS_PER_SECOND

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Messages::TimeConversion

#duration_to_seconds, #seconds_to_duration, #time_to_timestamp, #timestamp_to_time

Constructor Details

#initialize(nanoseconds) ⇒ Duration

Returns a new instance of Duration.



402
403
404
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 402

def initialize(nanoseconds)
  @nanoseconds = nanoseconds
end

Instance Attribute Details

#nanosecondsObject (readonly)

Returns the value of attribute nanoseconds.



400
401
402
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 400

def nanoseconds
  @nanoseconds
end

Instance Method Details

#to_message_durationObject



406
407
408
409
410
411
412
413
414
415
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/result.rb', line 406

def to_message_duration
  duration_hash = seconds_to_duration(nanoseconds.to_f / NANOSECONDS_PER_SECOND)
  duration_hash.transform_keys! do |key|
    key.to_sym
  rescue Error
    return key
  end

  Cucumber::Messages::Duration.from_h(duration_hash)
end