Class: RShade::EventProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/rshade/event_processor.rb

Overview

nodoc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store, config) ⇒ EventProcessor

Returns a new instance of EventProcessor.



6
7
8
9
10
# File 'lib/rshade/event_processor.rb', line 6

def initialize(store, config)
  @store = store
  custom_serializers = config.custom_serializers
  @var_serializer = ::RShade::Serializer::Traversal.new(custom_serializers)
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



4
5
6
# File 'lib/rshade/event_processor.rb', line 4

def store
  @store
end

Instance Method Details

#enter(event, level) ⇒ Object

Parameters:



14
15
16
17
# File 'lib/rshade/event_processor.rb', line 14

def enter(event, level)
  event.with_serialized_vars!(@var_serializer).with_level!(level)
  store.add(event, level)
end

#leave(event, level) ⇒ Object

Parameters:



21
22
23
24
25
26
27
28
29
# File 'lib/rshade/event_processor.rb', line 21

def leave(event, level)
  store.current! do |node|
      node.value.set_return_value!(event.return_value)
          .with_serialized_return!(->(value) { value.inspect })
  end
rescue => e
  # this rescue here due this issue which reproduce in ruby-2.6.6 at least
  # https://bugs.ruby-lang.org/issues/18060
end

#other(event, level) ⇒ Object

Parameters:



32
33
34
# File 'lib/rshade/event_processor.rb', line 32

def other(event, level)

end