Class: Cucumber::Core::Test::Result::Duration
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::Duration
- Includes:
- Messages::TimeConversion
- Defined in:
- lib/cucumber/core/test/result.rb
Instance Attribute Summary collapse
-
#nanoseconds ⇒ Object
readonly
Returns the value of attribute nanoseconds.
Instance Method Summary collapse
-
#initialize(nanoseconds) ⇒ Duration
constructor
A new instance of Duration.
- #to_message_duration ⇒ Object
Constructor Details
#initialize(nanoseconds) ⇒ Duration
Returns a new instance of Duration.
411 412 413 |
# File 'lib/cucumber/core/test/result.rb', line 411 def initialize(nanoseconds) @nanoseconds = nanoseconds end |
Instance Attribute Details
#nanoseconds ⇒ Object (readonly)
Returns the value of attribute nanoseconds.
409 410 411 |
# File 'lib/cucumber/core/test/result.rb', line 409 def nanoseconds @nanoseconds end |
Instance Method Details
#to_message_duration ⇒ Object
415 416 417 418 419 420 421 422 423 424 |
# File 'lib/cucumber/core/test/result.rb', line 415 def 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 |