Class: Spektr::Targets::Routes::Action
- Inherits:
-
Exp::Definition
- Object
- Exp::Base
- Exp::Definition
- Spektr::Targets::Routes::Action
- Defined in:
- lib/spektr/targets/routes.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#template ⇒ Object
Returns the value of attribute template.
Attributes inherited from Exp::Definition
Attributes inherited from Exp::Base
#arguments, #ast, #body, #location, #name, #options, #type
Instance Method Summary collapse
-
#initialize(ast, controller) ⇒ Action
constructor
A new instance of Action.
Methods inherited from Exp::Definition
Methods inherited from Exp::Base
#handler_missing, #process, #send?
Constructor Details
#initialize(ast, controller) ⇒ Action
Returns a new instance of Action.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/spektr/targets/routes.rb', line 18 def initialize(ast, controller) super(ast) @template = File.join(controller.name.delete_suffix("Controller").underscore, name.to_s) @body.each do |exp| if exp.send? if exp.name == :render if exp.arguments.first.type == :sym @template = File.join(controller.name.delete_suffix("Controller").underscore, exp.arguments.first.name.to_s) elsif if exp.arguments.first.type == :str @template = exp.arguments.first.name end end end end end end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
17 18 19 |
# File 'lib/spektr/targets/routes.rb', line 17 def controller @controller end |
#template ⇒ Object
Returns the value of attribute template.
17 18 19 |
# File 'lib/spektr/targets/routes.rb', line 17 def template @template end |