Class: Cucumber::Messages::PickleTable
- Defined in:
- lib/cucumber/messages/pickle_table.rb
Overview
Represents the PickleTable message in Cucumber's message protocol.
Instance Attribute Summary collapse
-
#argument_index ⇒ Object
readonly
The index of this argument.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new PickleTable from the given hash.
Instance Method Summary collapse
-
#initialize(argument_index: nil, rows: []) ⇒ PickleTable
constructor
A new instance of PickleTable.
Methods inherited from Message
camelize, from_json, #to_h, #to_json, #type
Constructor Details
#initialize(argument_index: nil, rows: []) ⇒ PickleTable
Returns a new instance of PickleTable.
18 19 20 21 22 23 24 25 |
# File 'lib/cucumber/messages/pickle_table.rb', line 18 def initialize( argument_index: nil, rows: [] ) @argument_index = argument_index @rows = rows super() end |
Instance Attribute Details
#argument_index ⇒ Object (readonly)
The index of this argument. The value is 0 if it was declared before the doc string, 1 if it was declared after.
14 15 16 |
# File 'lib/cucumber/messages/pickle_table.rb', line 14 def argument_index @argument_index end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
16 17 18 |
# File 'lib/cucumber/messages/pickle_table.rb', line 16 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... ...>
34 35 36 37 38 39 40 41 |
# File 'lib/cucumber/messages/pickle_table.rb', line 34 def self.from_h(hash) return nil if hash.nil? new( argument_index: hash[:argumentIndex], rows: hash[:rows]&.map { |item| PickleTableRow.from_h(item) } ) end |