Class: Cucumber::Messages::TestRunHookStarted
- Defined in:
- lib/cucumber/messages/test_run_hook_started.rb
Overview
Represents the TestRunHookStarted message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#hook_id ⇒ Object
readonly
Identifier for the hook that will be executed.
-
#id ⇒ Object
readonly
Unique identifier for this hook execution.
-
#test_run_started_id ⇒ Object
readonly
Identifier for the test run that this hook execution belongs to.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new TestRunHookStarted from the given hash.
Instance Method Summary collapse
-
#initialize(id: '', test_run_started_id: '', hook_id: '', timestamp: Timestamp.new) ⇒ TestRunHookStarted
constructor
A new instance of TestRunHookStarted.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(id: '', test_run_started_id: '', hook_id: '', timestamp: Timestamp.new) ⇒ TestRunHookStarted
Returns a new instance of TestRunHookStarted.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 28 def initialize( id: '', test_run_started_id: '', hook_id: '', timestamp: Timestamp.new ) @id = id @test_run_started_id = test_run_started_id @hook_id = hook_id @timestamp = super() end |
Instance Attribute Details
#hook_id ⇒ Object (readonly)
Identifier for the hook that will be executed
24 25 26 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 24 def hook_id @hook_id end |
#id ⇒ Object (readonly)
Unique identifier for this hook execution
14 15 16 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 14 def id @id end |
#test_run_started_id ⇒ Object (readonly)
Identifier for the test run that this hook execution belongs to
19 20 21 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 19 def test_run_started_id @test_run_started_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
26 27 28 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 26 def @timestamp end |
Class Method Details
.from_h(hash) ⇒ Object
Returns a new TestRunHookStarted from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::TestRunHookStarted.from_h(some_hash) # => #<Cucumber::Messages::TestRunHookStarted:0x... ...>
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 48 def self.from_h(hash) return nil if hash.nil? new( id: hash[:id], test_run_started_id: hash[:testRunStartedId], hook_id: hash[:hookId], timestamp: Timestamp.from_h(hash[:timestamp]) ) end |