Module: Cucumber::Core::Events

Defined in:
lib/cucumber/core/events.rb

Defined Under Namespace

Classes: GherkinSourceParsed, TestCaseFinished, TestCaseStarted, TestStepFinished, TestStepStarted

Class Method Summary collapse

Class Method Details

.build_registry(*types) ⇒ Hash{Symbol => Class}

Build an event registry to be passed to the Cucumber::Core::EventBus constructor from a list of types.

Each type must respond to ‘event_id` so that it can be added to the registry hash.

Returns:

  • (Hash{Symbol => Class})


73
74
75
# File 'lib/cucumber/core/events.rb', line 73

def self.build_registry(*types)
  types.map { |type| [type.event_id, type] }.to_h
end

.registryObject

The registry contains all the events registered in the core, that will be used by the Cucumber::Core::EventBus by default.



56
57
58
59
60
61
62
63
64
# File 'lib/cucumber/core/events.rb', line 56

def self.registry
  build_registry(
    GherkinSourceParsed,
    TestCaseStarted,
    TestStepStarted,
    TestStepFinished,
    TestCaseFinished,
  )
end