Class: Brakeman::Model

Inherits:
Collection show all
Includes:
ModelMethods
Defined in:
lib/brakeman/tracker/model.rb

Constant Summary collapse

ASSOCIATIONS =

Constants included from Util

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

Instance Attribute Summary

Attributes included from ModelMethods

#associations, #attr_accessible, #role_accessible

Attributes inherited from Collection

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

Instance Method Summary collapse

Methods included from ModelMethods

#association?, #attr_protected, #initialize_model, #parent_classes_protected?, #set_attr_accessible, #set_attr_protected, #unprotected_model?

Methods inherited from Collection

#add_file, #add_include, #add_method, #ancestor?, #each_method, #file, #get_method, #methods_public, #top_line

Methods included from Util

#array?, #block?, #call?, #camelize, #class_name, #constant?, #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, parent, file_name, src, tracker) ⇒ Model

Returns a new instance of Model.



75
76
77
78
79
# File 'lib/brakeman/tracker/model.rb', line 75

def initialize name, parent, file_name, src, tracker
  super
  initialize_model
  @collection = tracker.models
end

Instance Method Details

#add_option(name, exp) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/brakeman/tracker/model.rb', line 81

def add_option name, exp
  if ASSOCIATIONS.include? name
    @associations[name] ||= []
    @associations[name].concat exp.args
  else
    super name, exp.arglist.line(exp.line)
  end
end