Class: Cucumber::Messages::Product

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

Overview

Represents the Product message in Cucumber’s message protocol.

Used to describe various properties of Meta

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(name: '', version: nil) ⇒ Product

Returns a new instance of Product.



984
985
986
987
988
989
990
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 984

def initialize(
  name: '',
  version: nil
)
  @name = name
  @version = version
end

Instance Attribute Details

#nameObject (readonly)

The product name



977
978
979
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 977

def name
  @name
end

#versionObject (readonly)

The product version



982
983
984
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 982

def version
  @version
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


547
548
549
550
551
552
553
554
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 547

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

  self.new(
    name: hash[:name],
    version: hash[:version],
  )
end