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.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
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, type: 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, type: nil) ⇒ Hook
Returns a new instance of Hook.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cucumber/messages/hook.rb', line 21 def initialize( id: '', name: nil, source_reference: SourceReference.new, tag_expression: nil, type: nil ) @id = id @name = name @source_reference = source_reference @tag_expression = tag_expression @type = type 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 |
#type ⇒ Object (readonly)
Returns the value of attribute type.
19 20 21 |
# File 'lib/cucumber/messages/hook.rb', line 19 def type @type end |
Class Method Details
.from_h(hash) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cucumber/messages/hook.rb', line 43 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], type: hash[:type] ) end |