Class: Cucumber::Messages::Comment

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

*

A comment in a Gherkin document

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, text: '') ⇒ Comment

Returns a new instance of Comment.



326
327
328
329
330
331
332
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 326

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

Instance Attribute Details

#locationObject (readonly)

The location of the comment



319
320
321
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 319

def location
  @location
end

#textObject (readonly)

The text of the comment



324
325
326
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 324

def text
  @text
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


146
147
148
149
150
151
152
153
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 146

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

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