Class: Cucumber::Messages::Timestamp

Inherits:
Message show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Message::Utils

included

Methods included from Message::Serialization

#to_h, #to_json

Methods included from Message::Deserialization

included

Constructor Details

#initialize(seconds: 0, nanos: 0) ⇒ Timestamp

Returns a new instance of Timestamp.



1856
1857
1858
1859
1860
1861
1862
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1856

def initialize(
  seconds: 0,
  nanos: 0
)
  @seconds = seconds
  @nanos = nanos
end

Instance Attribute Details

#nanosObject (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.


1854
1855
1856
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1854

def nanos
  @nanos
end

#secondsObject (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.


1846
1847
1848
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1846

def seconds
  @seconds
end

Class Method Details

.from_h(hash) ⇒ Object

Returns a new Timestamp from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::Timestamp.from_h(some_hash) # => #<Cucumber::Messages::Timestamp:0x... ...>


1151
1152
1153
1154
1155
1156
1157
1158
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 1151

def self.from_h(hash)
  return nil if hash.nil?

  self.new(
    seconds: hash[:seconds],
    nanos: hash[:nanos],
  )
end