Class: Cucumber::Messages::Feature

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, tags: [], language: '', keyword: '', name: '', description: '', children: []) ⇒ Feature

Returns a new instance of Feature.



480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 480

def initialize(
  location: Location.new,
  tags: [],
  language: '',
  keyword: '',
  name: '',
  description: '',
  children: []
)
  @location = location
  @tags = tags
  @language = language
  @keyword = keyword
  @name = name
  @description = description
  @children = children
end

Instance Attribute Details

#childrenObject (readonly)

Zero or more children



478
479
480
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 478

def children
  @children
end

#descriptionObject (readonly)

The line(s) underneath the line with the ‘keyword` that are used as description



473
474
475
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 473

def description
  @description
end

#keywordObject (readonly)

The text of the ‘Feature` keyword (in the language specified by `language`)



463
464
465
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 463

def keyword
  @keyword
end

#languageObject (readonly)

The [ISO 639-1](en.wikipedia.org/wiki/ISO_639-1) language code of the Gherkin document



458
459
460
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 458

def language
  @language
end

#locationObject (readonly)

The location of the ‘Feature` keyword



448
449
450
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 448

def location
  @location
end

#nameObject (readonly)

The name of the feature (the text following the ‘keyword`)



468
469
470
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 468

def name
  @name
end

#tagsObject (readonly)

All the tags placed above the ‘Feature` keyword



453
454
455
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 453

def tags
  @tags
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 234

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

  self.new(
    location: Location.from_h(hash[:location]),
    tags: hash[:tags]&.map { |item| Tag.from_h(item) },
    language: hash[:language],
    keyword: hash[:keyword],
    name: hash[:name],
    description: hash[:description],
    children: hash[:children]&.map { |item| FeatureChild.from_h(item) },
  )
end