Class: Tapioca::Gem::Listeners::Base

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/tapioca/gem/listeners/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(pipeline) ⇒ Base

Returns a new instance of Base.



14
15
16
# File 'lib/tapioca/gem/listeners/base.rb', line 14

def initialize(pipeline)
  @pipeline = pipeline
end

Instance Method Details

#dispatch(event) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tapioca/gem/listeners/base.rb', line 19

def dispatch(event)
  return if ignore?(event)

  case event
  when ConstNodeAdded
    on_const(event)
  when ScopeNodeAdded
    on_scope(event)
  when MethodNodeAdded
    on_method(event)
  else
    raise "Unsupported event #{event.class}"
  end
end