Class: Cucumber::Messages::PickleStep
- Defined in:
- lib/cucumber/messages/pickle_step.rb
Overview
Represents the PickleStep message in Cucumber's message protocol.
An executable step
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
The first argument for this step, if any.
-
#ast_node_ids ⇒ Object
readonly
References the IDs of the source of the step.
-
#id ⇒ Object
readonly
A unique ID for the PickleStep.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
The context in which the step was specified: context (Given), action (When) or outcome (Then).
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new PickleStep from the given hash.
Instance Method Summary collapse
-
#initialize(argument: nil, ast_node_ids: [], id: '', type: nil, text: '') ⇒ PickleStep
constructor
A new instance of PickleStep.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(argument: nil, ast_node_ids: [], id: '', type: nil, text: '') ⇒ PickleStep
Returns a new instance of PickleStep.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cucumber/messages/pickle_step.rb', line 38 def initialize( argument: nil, ast_node_ids: [], id: '', type: nil, text: '' ) @argument = argument @ast_node_ids = ast_node_ids @id = id @type = type @text = text super() end |
Instance Attribute Details
#argument ⇒ Object (readonly)
The first argument for this step, if any
16 17 18 |
# File 'lib/cucumber/messages/pickle_step.rb', line 16 def argument @argument end |
#ast_node_ids ⇒ Object (readonly)
References the IDs of the source of the step. For Gherkin, this can be the ID of a Step, and possibly also the ID of a TableRow
22 23 24 |
# File 'lib/cucumber/messages/pickle_step.rb', line 22 def ast_node_ids @ast_node_ids end |
#id ⇒ Object (readonly)
A unique ID for the PickleStep
27 28 29 |
# File 'lib/cucumber/messages/pickle_step.rb', line 27 def id @id end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
36 37 38 |
# File 'lib/cucumber/messages/pickle_step.rb', line 36 def text @text end |
#type ⇒ Object (readonly)
The context in which the step was specified: context (Given), action (When) or outcome (Then).
Note that the keywords But and And inherit their meaning from prior steps and the * 'keyword' doesn't have specific meaning (hence Unknown)
34 35 36 |
# File 'lib/cucumber/messages/pickle_step.rb', line 34 def type @type end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new PickleStep from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::PickleStep.from_h(some_hash) # => #<Cucumber::Messages::PickleStep:0x... ...>
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cucumber/messages/pickle_step.rb', line 60 def self.from_h(hash) return nil if hash.nil? new( argument: PickleStepArgument.from_h(hash[:argument]), ast_node_ids: hash[:astNodeIds], id: hash[:id], type: hash[:type], text: hash[:text] ) end |