Class: Cucumber::Messages::PickleStepArgument

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

Overview

Represents the PickleStepArgument message in Cucumber’s message protocol.

An optional argument

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(doc_string: nil, data_table: nil) ⇒ PickleStepArgument

Returns a new instance of PickleStepArgument.



17
18
19
20
21
22
23
24
# File 'lib/cucumber/messages/pickle_step_argument.rb', line 17

def initialize(
  doc_string: nil,
  data_table: nil
)
  @doc_string = doc_string
  @data_table = data_table
  super()
end

Instance Attribute Details

#data_tableObject (readonly)

Returns the value of attribute data_table.



15
16
17
# File 'lib/cucumber/messages/pickle_step_argument.rb', line 15

def data_table
  @data_table
end

#doc_stringObject (readonly)

Returns the value of attribute doc_string.



13
14
15
# File 'lib/cucumber/messages/pickle_step_argument.rb', line 13

def doc_string
  @doc_string
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


33
34
35
36
37
38
39
40
# File 'lib/cucumber/messages/pickle_step_argument.rb', line 33

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

  new(
    doc_string: PickleDocString.from_h(hash[:docString]),
    data_table: PickleTable.from_h(hash[:dataTable])
  )
end