Class: Brakeman::Template

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

Constant Summary

Constants included from Util

Util::ALL_PARAMETERS, Util::COOKIES, Util::COOKIES_SEXP, Util::PARAMETERS, Util::PARAMS_SEXP, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_ENV, Util::REQUEST_PARAMETERS, Util::REQUEST_PARAMS, Util::SESSION, Util::SESSION_SEXP

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_method, #methods_public, #top_line

Methods included from Util

#array?, #block?, #call?, #camelize, #class_name, #contains_class?, #context_for, #cookies?, #false?, #file_by_name, #file_for, #github_url, #hash?, #hash_access, #hash_insert, #hash_iterate, #integer?, #make_call, #node_type?, #number?, #params?, #pluralize, #rails_version, #regexp?, #relative_path, #request_env?, #request_value?, #result?, #set_env_defaults, #sexp?, #string?, #string_interp?, #symbol?, #table_to_csv, #template_path_to_name, #true?, #truncate_table, #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