Class: JsDuck::Process::Fires

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/process/fires.rb

Overview

Expands lists of fired events to take into account events fired by all the methods that get called by a method.

Instance Method Summary collapse

Constructor Details

#initialize(relations) ⇒ Fires

Returns a new instance of Fires.



9
10
11
12
13
14
15
16
17
# File 'lib/jsduck/process/fires.rb', line 9

def initialize(relations)
  @relations = relations
  # Map of methods for which all @fires tags have been detected.
  # So we don't repeat the resolving.
  @detected = {}
  # Map of methods that we're currently resolving.
  # So we don't recurse into infinity.
  @call_chain = {}
end

Instance Method Details

#process_all!Object

Populates @fires tags with additional events.



20
21
22
23
24
25
26
27
# File 'lib/jsduck/process/fires.rb', line 20

def process_all!
  @relations.each do |cls|
    cls.find_members(:tagname => :method, :static => false).each do |m|
      @call_chain = {m[:name] => true}
      detect_fires(cls, m)
    end
  end
end