Class: Cucumber::Messages::Background

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

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(location: Location.new, keyword: '', name: '', description: '', steps: [], id: '') ⇒ Background

Returns a new instance of Background.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 289

def initialize(
  location: Location.new,
  keyword: '',
  name: '',
  description: '',
  steps: [],
  id: ''
)
  @location = location
  @keyword = keyword
  @name = name
  @description = description
  @steps = steps
  @id = id
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



283
284
285
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 283

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



287
288
289
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 287

def id
  @id
end

#keywordObject (readonly)

Returns the value of attribute keyword.



279
280
281
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 279

def keyword
  @keyword
end

#locationObject (readonly)

The location of the ‘Background` keyword



277
278
279
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 277

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



281
282
283
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 281

def name
  @name
end

#stepsObject (readonly)

Returns the value of attribute steps.



285
286
287
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 285

def steps
  @steps
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 122

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

  self.new(
    location: Location.from_h(hash[:location]),
    keyword: hash[:keyword],
    name: hash[:name],
    description: hash[:description],
    steps: hash[:steps]&.map { |item| Step.from_h(item) },
    id: hash[:id],
  )
end