Class: Cucumber::Messages::Hook
- Defined in:
- lib/cucumber/messages/hook.rb
Overview
Represents the Hook message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_reference ⇒ Object
readonly
Returns the value of attribute source_reference.
-
#tag_expression ⇒ Object
readonly
Returns the value of attribute tag_expression.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Hook from the given hash.
Instance Method Summary collapse
-
#initialize(id: '', name: nil, source_reference: SourceReference.new, tag_expression: nil) ⇒ Hook
constructor
A new instance of Hook.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(id: '', name: nil, source_reference: SourceReference.new, tag_expression: nil) ⇒ Hook
Returns a new instance of Hook.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cucumber/messages/hook.rb', line 19 def initialize( id: '', name: nil, source_reference: SourceReference.new, tag_expression: nil ) @id = id @name = name @source_reference = source_reference @tag_expression = tag_expression super() end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/cucumber/messages/hook.rb', line 11 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/cucumber/messages/hook.rb', line 13 def name @name end |
#source_reference ⇒ Object (readonly)
Returns the value of attribute source_reference.
15 16 17 |
# File 'lib/cucumber/messages/hook.rb', line 15 def source_reference @source_reference end |
#tag_expression ⇒ Object (readonly)
Returns the value of attribute tag_expression.
17 18 19 |
# File 'lib/cucumber/messages/hook.rb', line 17 def tag_expression @tag_expression end |
Class Method Details
.from_h(hash) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cucumber/messages/hook.rb', line 39 def self.from_h(hash) return nil if hash.nil? new( id: hash[:id], name: hash[:name], source_reference: SourceReference.from_h(hash[:sourceReference]), tag_expression: hash[:tagExpression] ) end |