Class: Cucumber::Messages::Tag

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

*

A tag

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, name: '', id: '') ⇒ Tag

Returns a new instance of Tag.



775
776
777
778
779
780
781
782
783
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 775

def initialize(
  location: Location.new,
  name: '',
  id: ''
)
  @location = location
  @name = name
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Unique ID to be able to reference the Tag from PickleTag



773
774
775
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 773

def id
  @id
end

#locationObject (readonly)

Location of the tag



763
764
765
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 763

def location
  @location
end

#nameObject (readonly)

The name of the tag (including the leading ‘@`)



768
769
770
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 768

def name
  @name
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


416
417
418
419
420
421
422
423
424
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 416

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

  self.new(
    location: Location.from_h(hash[:location]),
    name: hash[:name],
    id: hash[:id],
  )
end