Class: Cucumber::Messages::Step

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

A step

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: '', text: '', doc_string: nil, data_table: nil, id: '') ⇒ Step

Returns a new instance of Step.



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 673

def initialize(
  location: Location.new,
  keyword: '',
  text: '',
  doc_string: nil,
  data_table: nil,
  id: ''
)
  @location = location
  @keyword = keyword
  @text = text
  @doc_string = doc_string
  @data_table = data_table
  @id = id
end

Instance Attribute Details

#data_tableObject (readonly)

Returns the value of attribute data_table.



666
667
668
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 666

def data_table
  @data_table
end

#doc_stringObject (readonly)

Returns the value of attribute doc_string.



664
665
666
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 664

def doc_string
  @doc_string
end

#idObject (readonly)

Unique ID to be able to reference the Step from PickleStep



671
672
673
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 671

def id
  @id
end

#keywordObject (readonly)

Returns the value of attribute keyword.



660
661
662
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 660

def keyword
  @keyword
end

#locationObject (readonly)

The location of the steps’ ‘keyword`



658
659
660
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 658

def location
  @location
end

#textObject (readonly)

Returns the value of attribute text.



662
663
664
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 662

def text
  @text
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 351

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

  self.new(
    location: Location.from_h(hash[:location]),
    keyword: hash[:keyword],
    text: hash[:text],
    doc_string: DocString.from_h(hash[:docString]),
    data_table: DataTable.from_h(hash[:dataTable]),
    id: hash[:id],
  )
end