Class: Cucumber::Messages::Group

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

Overview

Represents the Group message in Cucumber’s message protocol.

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(children: [], start: nil, value: nil) ⇒ Group

Returns a new instance of Group.



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

def initialize(
  children: [],
  start: nil,
  value: nil
)
  @children = children
  @start = start
  @value = value
  super()
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



11
12
13
# File 'lib/cucumber/messages/group.rb', line 11

def children
  @children
end

#startObject (readonly)

Returns the value of attribute start.



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

def start
  @start
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


35
36
37
38
39
40
41
42
43
# File 'lib/cucumber/messages/group.rb', line 35

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