Class: Cucumber::Messages::Tag
- Defined in:
- lib/cucumber/messages/tag.rb
Overview
Represents the Tag message in Cucumber's message protocol.
A tag
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Unique ID to be able to reference the Tag from PickleTag.
-
#location ⇒ Object
readonly
Location of the tag.
-
#name ⇒ Object
readonly
The name of the tag (including the leading
@).
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Tag from the given hash.
Instance Method Summary collapse
-
#initialize(location: Location.new, name: '', id: '') ⇒ Tag
constructor
A new instance of Tag.
Methods inherited from Message
camelize, from_json, #to_h, #to_json, #type
Constructor Details
#initialize(location: Location.new, name: '', id: '') ⇒ Tag
Returns a new instance of Tag.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cucumber/messages/tag.rb', line 28 def initialize( location: Location.new, name: '', id: '' ) @location = location @name = name @id = id super() end |
Instance Attribute Details
#id ⇒ Object (readonly)
Unique ID to be able to reference the Tag from PickleTag
26 27 28 |
# File 'lib/cucumber/messages/tag.rb', line 26 def id @id end |
#location ⇒ Object (readonly)
Location of the tag
16 17 18 |
# File 'lib/cucumber/messages/tag.rb', line 16 def location @location end |
#name ⇒ Object (readonly)
The name of the tag (including the leading @)
21 22 23 |
# File 'lib/cucumber/messages/tag.rb', line 21 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... ...>
46 47 48 49 50 51 52 53 54 |
# File 'lib/cucumber/messages/tag.rb', line 46 def self.from_h(hash) return nil if hash.nil? new( location: Location.from_h(hash[:location]), name: hash[:name], id: hash[:id] ) end |