Class: Cucumber::Events::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/events/base.rb

Overview

An archetype of what each Cucumber Event defined in cucumber-ruby must adhere to

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.event_idObject

The “key” name of the class to be used as the key in the event registry (Underscored name symbolized)

@return [Symbol]


10
11
12
# File 'lib/cucumber/events/base.rb', line 10

def self.event_id
  raise 'Must be implemented in subclass'
end

Instance Method Details

#event_idObject



20
21
22
# File 'lib/cucumber/events/base.rb', line 20

def event_id
  self.class.event_id
end

#to_hObject

The properties of each event. Stored in iVar named format - where the key is the name of the iVar

@return [Hash<Symbol>]


16
17
18
# File 'lib/cucumber/events/base.rb', line 16

def to_h
  instance_variables.to_h { |variable_name| [variable_name[1..].to_sym, instance_variable_get(variable_name)] }
end