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.



8
9
10
11
12
# File 'lib/rshade/event_processor.rb', line 8

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

Instance Attribute Details

#serializerObject (readonly)

Returns the value of attribute serializer.



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

def serializer
  @serializer
end

#storeObject (readonly)

Returns the value of attribute store.



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

def store
  @store
end

Instance Method Details

#enter(event, level) ⇒ Object

Parameters:



16
17
18
19
# File 'lib/rshade/event_processor.rb', line 16

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

#leave(event, _level) ⇒ Object

Parameters:



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

def leave(event, _level)
  store.current! do |node|
    node.value.return_value!(event.return_value)
        .with_serialized_return!(serializer)
  end
rescue StandardError
  # 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:



35
# File 'lib/rshade/event_processor.rb', line 35

def other(event, level); end