class BetterRailsDebugger::Parser::Ruby::Processor

Attributes

information[R]

Public Class Methods

new() click to toggle source
# File lib/better_rails_debugger/parser/ruby/processor.rb, line 4
def initialize
  @information = ActiveSupport::HashWithIndifferentAccess.new
end

Public Instance Methods

cleanup_subscriptions() click to toggle source
# File lib/better_rails_debugger/parser/ruby/processor.rb, line 38
def cleanup_subscriptions
  @subscriptions = Hash.new()
end
emit_signal(signal_name, node) click to toggle source

Call all subscriptions for the given signal @param signal_name Symbol @param args Hash

# File lib/better_rails_debugger/parser/ruby/processor.rb, line 10
def emit_signal(signal_name, node)
  @subscriptions ||= Hash.new()
  @runner ||= BetterRailsDebugger::Parser::Ruby::ContextRunner.new self
  (@subscriptions[signal_name] || {}).values.each do |block|
    @runner.node = node
    @runner.instance_eval &block
    # block.call(node)
  end
end
setup() click to toggle source
# File lib/better_rails_debugger/parser/ruby/processor.rb, line 42
def setup
  (@extensions = ::BetterRailsDebugger::Parser::Ruby::Extension.sorted_extensions).map do |klass|
    instance = klass.new self
    instance.setup
    instance
  end
end
subscribe_signal(signal_name, step=:first_pass, &block) click to toggle source

Subscribe to a particular signal @param signal_name Symbol @param step Symbol May be :first_pass or :second_pass @param block Proc

# File lib/better_rails_debugger/parser/ruby/processor.rb, line 24
def subscribe_signal(signal_name, step=:first_pass, &block)
  key = SecureRandom.hex(5)
  @subscriptions ||= Hash.new()
  @subscriptions[signal_name] ||= Hash.new
  @subscriptions[signal_name][key] = block
  key
end
unsubscribe(signal_name, hash) click to toggle source
# File lib/better_rails_debugger/parser/ruby/processor.rb, line 32
def unsubscribe(signal_name, hash)
  @subscriptions ||= Hash.new()
  @subscriptions[signal_name] ||= Hash.new
  @subscriptions[signal_name].delete hash
end