Class: Cucumber::Messages::TableRow

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 TableRow message in Cucumber’s message protocol.

A row in a table

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(location: Location.new, cells: [], id: '') ⇒ TableRow

Returns a new instance of TableRow.



739
740
741
742
743
744
745
746
747
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 739

def initialize(
  location: Location.new,
  cells: [],
  id: ''
)
  @location = location
  @cells = cells
  @id = id
end

Instance Attribute Details

#cellsObject (readonly)

Cells in the row



735
736
737
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 735

def cells
  @cells
end

#idObject (readonly)

Returns the value of attribute id.



737
738
739
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 737

def id
  @id
end

#locationObject (readonly)

The location of the first cell in the row



730
731
732
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 730

def location
  @location
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


395
396
397
398
399
400
401
402
403
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 395

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

  self.new(
    location: Location.from_h(hash[:location]),
    cells: hash[:cells]&.map { |item| TableCell.from_h(item) },
    id: hash[:id],
  )
end