Class: Cucumber::Messages::RuleChild

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

*

A child node of a `Rule` node

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

Returns a new instance of RuleChild.



588
589
590
591
592
593
594
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 588

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

Instance Attribute Details

#backgroundObject (readonly)

Returns the value of attribute background.



584
585
586
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 584

def background
  @background
end

#scenarioObject (readonly)

Returns the value of attribute scenario.



586
587
588
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 586

def scenario
  @scenario
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


305
306
307
308
309
310
311
312
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 305

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

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