Class: Cucumber::Messages::StepMatchArgument

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

*

Represents a single argument extracted from a step match and passed to a step definition.
This is used for the following purposes:
- Construct an argument to pass to a step definition (possibly through a parameter type transform)
- Highlight the matched parameter in rich formatters such as the HTML formatter

This message closely matches the `Argument` class in the `cucumber-expressions` library.

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(group: Group.new, parameter_type_name: nil) ⇒ StepMatchArgument

Returns a new instance of StepMatchArgument.



1550
1551
1552
1553
1554
1555
1556
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1550

def initialize(
  group: Group.new,
  parameter_type_name: nil
)
  @group = group
  @parameter_type_name = parameter_type_name
end

Instance Attribute Details

#groupObject (readonly)

*

Represents the outermost capture group of an argument. This message closely matches the
`Group` class in the `cucumber-expressions` library.


1546
1547
1548
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1546

def group
  @group
end

#parameter_type_nameObject (readonly)

Returns the value of attribute parameter_type_name.



1548
1549
1550
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1548

def parameter_type_name
  @parameter_type_name
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


942
943
944
945
946
947
948
949
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 942

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

  self.new(
    group: Group.from_h(hash[:group]),
    parameter_type_name: hash[:parameterTypeName],
  )
end