Class: Cucumber::Messages::Rule

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: [], keyword: '', name: '', description: '', children: [], id: '') ⇒ Rule

Returns a new instance of Rule.



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 555

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

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



551
552
553
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 551

def children
  @children
end

#descriptionObject (readonly)

Returns the value of attribute description.



549
550
551
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 549

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



553
554
555
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 553

def id
  @id
end

#keywordObject (readonly)

Returns the value of attribute keyword.



545
546
547
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 545

def keyword
  @keyword
end

#locationObject (readonly)

The location of the ‘Rule` keyword



538
539
540
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 538

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



547
548
549
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 547

def name
  @name
end

#tagsObject (readonly)

All the tags placed above the ‘Rule` keyword



543
544
545
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 543

def tags
  @tags
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 280

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) },
    keyword: hash[:keyword],
    name: hash[:name],
    description: hash[:description],
    children: hash[:children]&.map { |item| RuleChild.from_h(item) },
    id: hash[:id],
  )
end