Class: Stratagem::Model::Component::Action
- Defined in:
- lib/stratagem/model/components/controller.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(controller, name, method) ⇒ Action
constructor
A new instance of Action.
- #model_invocations(type = nil) ⇒ Object
Constructor Details
#initialize(controller, name, method) ⇒ Action
Returns a new instance of Action.
7 8 9 10 11 12 |
# File 'lib/stratagem/model/components/controller.rb', line 7 def initialize(controller, name, method) @controller = controller @name = name @method = method # :put, :get, :post, :delete @models_rendered = {} # model => [MethodInvocation] end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
5 6 7 |
# File 'lib/stratagem/model/components/controller.rb', line 5 def controller @controller end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/stratagem/model/components/controller.rb', line 5 def name @name end |
Instance Method Details
#model_invocations(type = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stratagem/model/components/controller.rb', line 14 def model_invocations(type=nil) puts "MODEL INVOCATIONS FOR: #{controller.klass.name} / #{name}" puts "\t#{Stratagem::Instrumentation::Models::Tracing.invocations_audit.size} total invocations" invocations = [] Stratagem::Instrumentation::Models::Tracing.invocations_audit.each {|invocation| if ((invocation.controller_path == controller.path) && (invocation.controller_action.to_s == self.name.to_s)) invocations << invocation unless invocations.include?(invocation) end } puts "\t#{invocations.size} filtered" invocations = invocations.select {|i| i.type == type } if type puts "\t#{invocations.size} selected" invocations.each do |i| puts "\t\t#{i.model.class.name} - #{i.controller.class.name}" end invocations end |