Class: Cucumber::Messages::Timestamp
- Defined in:
- lib/cucumber/messages/timestamp.rb
Overview
Represents the Timestamp message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#nanos ⇒ Object
readonly
Non-negative fractions of a second at nanosecond resolution.
-
#seconds ⇒ Object
readonly
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Timestamp from the given hash.
Instance Method Summary collapse
-
#initialize(seconds: 0, nanos: 0) ⇒ Timestamp
constructor
A new instance of Timestamp.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(seconds: 0, nanos: 0) ⇒ Timestamp
Returns a new instance of Timestamp.
26 27 28 29 30 31 32 33 |
# File 'lib/cucumber/messages/timestamp.rb', line 26 def initialize( seconds: 0, nanos: 0 ) @seconds = seconds @nanos = nanos super() end |
Instance Attribute Details
#nanos ⇒ Object (readonly)
Non-negative fractions of a second at nanosecond resolution. Negative
second values with fractions must still have non-negative nanos values
that count forward in time. Must be from 0 to 999,999,999
inclusive.
24 25 26 |
# File 'lib/cucumber/messages/timestamp.rb', line 24 def nanos @nanos end |
#seconds ⇒ Object (readonly)
Represents seconds of UTC time since Unix epoch
1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
9999-12-31T23:59:59Z inclusive.
16 17 18 |
# File 'lib/cucumber/messages/timestamp.rb', line 16 def seconds @seconds end |
Class Method Details
.from_h(hash) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/cucumber/messages/timestamp.rb', line 42 def self.from_h(hash) return nil if hash.nil? new( seconds: hash[:seconds], nanos: hash[:nanos] ) end |