Class: Brakeman::Template

Inherits:
Collection show all
Defined in:
lib/brakeman/tracker/template.rb

Constant Summary

Constants included from Util

Util::ALL_COOKIES, Util::ALL_PARAMETERS, Util::COOKIES, Util::COOKIES_SEXP, Util::DIR_CONST, Util::LITERALS, Util::PARAMETERS, Util::PARAMS_SEXP, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_COOKIES, Util::REQUEST_ENV, Util::REQUEST_PARAMETERS, Util::REQUEST_PARAMS, Util::REQUEST_REQUEST_PARAMETERS, Util::SAFE_LITERAL, Util::SESSION, Util::SESSION_SEXP, Util::SIMPLE_LITERALS

Instance Attribute Summary collapse

Attributes inherited from Collection

#collection, #files, #includes, #name, #options, #parent, #src, #tracker

Instance Method Summary collapse

Methods inherited from Collection

#add_file, #add_include, #add_method, #add_option, #ancestor?, #each_method, #file, #get_class_method, #get_instance_method, #get_method, #get_simple_method_return_value, #methods_public, #top_line

Methods included from Util

#all_literals?, #array?, #block?, #call?, #camelize, #class_name, #constant?, #contains_class?, #cookies?, #dir_glob?, #false?, #hash?, #hash_access, #hash_insert, #hash_iterate, #hash_values, #integer?, #kwsplat?, #literal?, #make_call, #node_type?, #number?, #params?, #pluralize, #rails_version, #recurse_check?, #regexp?, #remove_kwsplat, #request_env?, #request_value?, #result?, #safe_literal, #safe_literal?, #safe_literal_target?, #set_env_defaults, #sexp?, #simple_literal?, #string?, #string_interp?, #symbol?, #template_path_to_name, #true?, #underscore

Constructor Details

#initialize(name, called_from, file_name, tracker) ⇒ Template

Returns a new instance of Template.



9
10
11
12
13
# File 'lib/brakeman/tracker/template.rb', line 9

def initialize name, called_from, file_name, tracker
  super name, nil, file_name, nil, tracker
  @render_path = called_from
  @outputs = []
end

Instance Attribute Details

#render_pathObject (readonly)

Returns the value of attribute render_path.



6
7
8
# File 'lib/brakeman/tracker/template.rb', line 6

def render_path
  @render_path
end

#src=(value) ⇒ Object (writeonly)

Sets the attribute src

Parameters:

  • value

    the value to set the attribute src to.



7
8
9
# File 'lib/brakeman/tracker/template.rb', line 7

def src=(value)
  @src = value
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/brakeman/tracker/template.rb', line 5

def type
  @type
end

Instance Method Details

#add_output(exp) ⇒ Object



15
16
17
# File 'lib/brakeman/tracker/template.rb', line 15

def add_output exp
  @outputs << exp
end

#each_outputObject



19
20
21
22
23
# File 'lib/brakeman/tracker/template.rb', line 19

def each_output
  @outputs.each do |o|
    yield o
  end
end

#rendered_from_controller?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
# File 'lib/brakeman/tracker/template.rb', line 25

def rendered_from_controller?
  if @render_path
    @render_path.rendered_from_controller?
  else
    false
  end
end