Module: Analyst::Processor

Defined in:
lib/analyst/processor.rb

Constant Summary collapse

PROCESSORS =
Hash.new(Analyst::Entities::Unhandled)

Class Method Summary collapse

Class Method Details

.process_node(node, parent) ⇒ Object



16
17
18
19
20
# File 'lib/analyst/processor.rb', line 16

def self.process_node(node, parent)
  return if node.nil?
  return unless node.respond_to?(:type)
  PROCESSORS[node.type].process(node, parent)
end

.register_processor(type, processor) ⇒ Object



9
10
11
12
13
14
# File 'lib/analyst/processor.rb', line 9

def self.register_processor(type, processor)
  if PROCESSORS.key? type
    raise "(#{type}) nodes already registered by #{PROCESSORS[type]}"
  end
  PROCESSORS[type] = processor
end