Class/Module Index [+]

Quicksearch

Brakeman::FindAllCalls

Attributes

calls[R]

Public Class Methods

new(tracker) click to toggle source
# File lib/brakeman/processors/lib/find_all_calls.rb, line 6
def initialize tracker
  super
  @current_class = nil
  @current_method = nil
  @in_target = false
  @calls = []
end

Public Instance Methods

process_attrasgn(exp) click to toggle source

Process an assignment like a call

# File lib/brakeman/processors/lib/find_all_calls.rb, line 101
def process_attrasgn exp
  process_call exp
end
process_call(exp) click to toggle source
# File lib/brakeman/processors/lib/find_all_calls.rb, line 38
def process_call exp
  target = get_target exp.target
  
  if call? target
    already_in_target = @in_target
    @in_target = true
    process target
    @in_target = already_in_target
  end

  method = exp.method
  process_call_args exp

  call = { :target => target, :method => method, :call => exp, :nested => @in_target, :chain => get_chain(exp) }
  
  if @current_template
    call[:location] = [:template, @current_template]
  else
    call[:location] = [:class, @current_class, @current_method]
  end

  @calls << call

  exp
end
process_dxstr(exp) click to toggle source

Technically, " is call to Kernel#` But we just need them in the call cache for speed

# File lib/brakeman/processors/lib/find_all_calls.rb, line 84
def process_dxstr exp
  process exp.last if sexp? exp.last

  call = { :target => nil, :method => :`, :call => exp, :nested => false }

  if @current_template
    call[:location] = [:template, @current_template]
  else
    call[:location] = [:class, @current_class, @current_method]
  end

  @calls << call

  exp
end
process_methdef(exp) click to toggle source

Process body of method

# File lib/brakeman/processors/lib/find_all_calls.rb, line 24
def process_methdef exp
  process_all exp.body
end
process_render(exp) click to toggle source

Calls to render() are converted to s(:render, ...) but we would like them in the call cache still for speed

# File lib/brakeman/processors/lib/find_all_calls.rb, line 66
def process_render exp
  process exp.last if sexp? exp.last

  call = { :target => nil, :method => :render, :call => exp, :nested => false }

  if @current_template
    call[:location] = [:template, @current_template]
  else
    call[:location] = [:class, @current_class, @current_method]
  end

  @calls << call

  exp
end
process_rlist(exp) click to toggle source

Process body of block

# File lib/brakeman/processors/lib/find_all_calls.rb, line 34
def process_rlist exp
  process_all exp
end
process_selfdef(exp) click to toggle source

Process body of method

# File lib/brakeman/processors/lib/find_all_calls.rb, line 29
def process_selfdef exp
  process_all exp.body
end
process_source(exp, klass = nil, method = nil, template = nil) click to toggle source

Process the given source. Provide either class and method being searched or the template. These names are used when reporting results.

# File lib/brakeman/processors/lib/find_all_calls.rb, line 16
def process_source exp, klass = nil, method = nil, template = nil
  @current_class = klass
  @current_method = method
  @current_template = template
  process exp
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.