Class: Cucumber::Messages::PickleTable

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/pickle_table.rb

Overview

Represents the PickleTable message in Cucumber’s message protocol.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(rows: []) ⇒ PickleTable

Returns a new instance of PickleTable.



13
14
15
16
17
18
# File 'lib/cucumber/messages/pickle_table.rb', line 13

def initialize(
  rows: []
)
  @rows = rows
  super()
end

Instance Attribute Details

#rowsObject (readonly)

Returns the value of attribute rows.



11
12
13
# File 'lib/cucumber/messages/pickle_table.rb', line 11

def rows
  @rows
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


27
28
29
30
31
32
33
# File 'lib/cucumber/messages/pickle_table.rb', line 27

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

  new(
    rows: hash[:rows]&.map { |item| PickleTableRow.from_h(item) }
  )
end