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.
30 31 32 33 34 |
# File 'lib/flok/user_compiler.rb', line 30 def initialize @controllers = [] @actions = [] @ons = [] end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
28 29 30 |
# File 'lib/flok/user_compiler.rb', line 28 def actions @actions end |
#controllers ⇒ Object
Returns the value of attribute controllers.
28 29 30 |
# File 'lib/flok/user_compiler.rb', line 28 def controllers @controllers end |
#ons ⇒ Object
Returns the value of attribute ons.
28 29 30 |
# File 'lib/flok/user_compiler.rb', line 28 def ons @ons end |
Instance Method Details
#action(controller, name, &block) ⇒ Object
44 45 46 |
# File 'lib/flok/user_compiler.rb', line 44 def action controller, name, &block @actions << UserCompilerAction.new(controller, name, self, &block) end |
#actions_for_controller(controller_name) ⇒ Object
51 52 53 |
# File 'lib/flok/user_compiler.rb', line 51 def actions_for_controller controller_name return @actions.select{|e| e.controller.name == controller_name} end |
#controller(name, &block) ⇒ Object
40 41 42 |
# File 'lib/flok/user_compiler.rb', line 40 def controller name, &block @controllers << UserCompilerController.new(name, self, &block) end |
#get_binding ⇒ Object
36 37 38 |
# File 'lib/flok/user_compiler.rb', line 36 def get_binding return binding end |
#on(controller_name, action_name, name, &block) ⇒ Object
48 49 |
# File 'lib/flok/user_compiler.rb', line 48 def on controller_name, action_name, name, &block end |
#spots_for_controller(controller_name) ⇒ Object
55 56 57 |
# File 'lib/flok/user_compiler.rb', line 55 def spots_for_controller controller_name return @controllers.detect{|e| e.name == controller_name}.spots end |