Class: Cucumber::Messages::Group
- Defined in:
- lib/cucumber/messages/group.rb
Overview
Represents the Group message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
The nested capture groups of an argument.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Group from the given hash.
Instance Method Summary collapse
-
#initialize(children: nil, start: nil, value: nil) ⇒ Group
constructor
A new instance of Group.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(children: nil, start: nil, value: nil) ⇒ Group
Returns a new instance of Group.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cucumber/messages/group.rb', line 21 def initialize( children: nil, start: nil, value: nil ) @children = children @start = start @value = value super() end |
Instance Attribute Details
#children ⇒ Object (readonly)
The nested capture groups of an argument. Absent if the group has no nested capture groups.
15 16 17 |
# File 'lib/cucumber/messages/group.rb', line 15 def children @children end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
17 18 19 |
# File 'lib/cucumber/messages/group.rb', line 17 def start @start end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
19 20 21 |
# File 'lib/cucumber/messages/group.rb', line 19 def value @value end |
Class Method Details
.from_h(hash) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/cucumber/messages/group.rb', line 39 def self.from_h(hash) return nil if hash.nil? new( children: hash[:children]&.map { |item| Group.from_h(item) }, start: hash[:start], value: hash[:value] ) end |