Class: Flok::UserCompilerContext
- Inherits:
-
Object
- Object
- Flok::UserCompilerContext
- Defined in:
- lib/flok/user_compiler.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#controllers ⇒ Object
Returns the value of attribute controllers.
-
#ons ⇒ Object
Returns the value of attribute ons.
Instance Method Summary collapse
- #action(controller, name, &block) ⇒ Object
- #actions_for_controller(controller_name) ⇒ Object
- #controller(name, &block) ⇒ Object
- #get_binding ⇒ Object
-
#initialize ⇒ UserCompilerContext
constructor
A new instance of UserCompilerContext.
- #on(controller_name, action_name, name, &block) ⇒ Object
- #spots_for_controller(controller_name) ⇒ Object
Constructor Details
#initialize ⇒ UserCompilerContext
Returns a new instance of UserCompilerContext.
28 29 30 31 32 |
# File 'lib/flok/user_compiler.rb', line 28 def initialize @controllers = [] @actions = [] @ons = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
26 27 28 |
# File 'lib/flok/user_compiler.rb', line 26 def actions @actions end |
#controllers ⇒ Object
Returns the value of attribute controllers.
26 27 28 |
# File 'lib/flok/user_compiler.rb', line 26 def controllers @controllers end |
#ons ⇒ Object
Returns the value of attribute ons.
26 27 28 |
# File 'lib/flok/user_compiler.rb', line 26 def ons @ons end |
Instance Method Details
#action(controller, name, &block) ⇒ Object
42 43 44 |
# File 'lib/flok/user_compiler.rb', line 42 def action controller, name, &block @actions << UserCompilerAction.new(controller, name, self, &block) end |
#actions_for_controller(controller_name) ⇒ Object
49 50 51 |
# File 'lib/flok/user_compiler.rb', line 49 def actions_for_controller controller_name return @actions.select{|e| e.controller.name == controller_name} end |
#controller(name, &block) ⇒ Object
38 39 40 |
# File 'lib/flok/user_compiler.rb', line 38 def controller name, &block @controllers << UserCompilerController.new(name, self, &block) end |
#get_binding ⇒ Object
34 35 36 |
# File 'lib/flok/user_compiler.rb', line 34 def get_binding return binding end |
#on(controller_name, action_name, name, &block) ⇒ Object
46 47 |
# File 'lib/flok/user_compiler.rb', line 46 def on controller_name, action_name, name, &block end |
#spots_for_controller(controller_name) ⇒ Object
53 54 55 |
# File 'lib/flok/user_compiler.rb', line 53 def spots_for_controller controller_name return @controllers.detect{|e| e.name == controller_name}.spots end |