Class: Cucumber::Messages::PickleTag

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/pickle_tag.rb

Overview

Represents the PickleTag message in Cucumber’s message protocol.

*

A tag

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(name: '', ast_node_id: '') ⇒ PickleTag

Returns a new instance of PickleTag.



21
22
23
24
25
26
27
28
# File 'lib/cucumber/messages/pickle_tag.rb', line 21

def initialize(
  name: '',
  ast_node_id: ''
)
  @name = name
  @ast_node_id = ast_node_id
  super()
end

Instance Attribute Details

#ast_node_idObject (readonly)

Points to the AST node this was created from



19
20
21
# File 'lib/cucumber/messages/pickle_tag.rb', line 19

def ast_node_id
  @ast_node_id
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/cucumber/messages/pickle_tag.rb', line 14

def name
  @name
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


37
38
39
40
41
42
43
44
# File 'lib/cucumber/messages/pickle_tag.rb', line 37

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

  new(
    name: hash[:name],
    ast_node_id: hash[:astNodeId]
  )
end