Class: Cucumber::Messages::FeatureChild

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

Overview

Represents the FeatureChild message in Cucumber’s message protocol.

*

A child node of a `Feature` node

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(rule: nil, background: nil, scenario: nil) ⇒ FeatureChild

Returns a new instance of FeatureChild.



20
21
22
23
24
25
26
27
28
29
# File 'lib/cucumber/messages/feature_child.rb', line 20

def initialize(
  rule: nil,
  background: nil,
  scenario: nil
)
  @rule = rule
  @background = background
  @scenario = scenario
  super()
end

Instance Attribute Details

#backgroundObject (readonly)

Returns the value of attribute background.



16
17
18
# File 'lib/cucumber/messages/feature_child.rb', line 16

def background
  @background
end

#ruleObject (readonly)

Returns the value of attribute rule.



14
15
16
# File 'lib/cucumber/messages/feature_child.rb', line 14

def rule
  @rule
end

#scenarioObject (readonly)

Returns the value of attribute scenario.



18
19
20
# File 'lib/cucumber/messages/feature_child.rb', line 18

def scenario
  @scenario
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


38
39
40
41
42
43
44
45
46
# File 'lib/cucumber/messages/feature_child.rb', line 38

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

  new(
    rule: Rule.from_h(hash[:rule]),
    background: Background.from_h(hash[:background]),
    scenario: Scenario.from_h(hash[:scenario])
  )
end