Class: Flok::UserCompilerController
- Inherits:
-
Object
- Object
- Flok::UserCompilerController
- Includes:
- UserCompilerMacro
- Defined in:
- lib/flok/user_compiler.rb
Instance Attribute Summary collapse
-
#_on_entry ⇒ Object
Returns the value of attribute _on_entry.
-
#_services ⇒ Object
Returns the value of attribute _services.
-
#macros ⇒ Object
Returns the value of attribute macros.
-
#name ⇒ Object
Returns the value of attribute name.
-
#spots(*spots) ⇒ Object
Names of spots.
Instance Method Summary collapse
-
#action(name, &block) ⇒ Object
Pass through action.
- #choose_action(&block) ⇒ Object
-
#initialize(name, ctx, &block) ⇒ UserCompilerController
constructor
A new instance of UserCompilerController.
-
#macro(name, &block) ⇒ Object
Create an action macro.
- #on_entry(str) ⇒ Object
- #services(*instance_names) ⇒ Object
Methods included from UserCompilerMacro
Constructor Details
#initialize(name, ctx, &block) ⇒ UserCompilerController
Returns a new instance of UserCompilerController.
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
# File 'lib/flok/user_compiler.rb', line 645 def initialize name, ctx, &block @name = name @ctx = ctx @spots = ['main'] @macros = {} @_services = [] #Some macros expect controller instance @controller = self self.instance_eval(&block) #Ensure that choose_action exists actions = @ctx.actions_for_controller(@name) unless actions.detect{|e| e.name === :choose_action} @ctx.action self, :choose_action do on_entry %{ Goto("#{actions[0].name}"); } end end end |
Instance Attribute Details
#_on_entry ⇒ Object
Returns the value of attribute _on_entry.
644 645 646 |
# File 'lib/flok/user_compiler.rb', line 644 def _on_entry @_on_entry end |
#_services ⇒ Object
Returns the value of attribute _services.
644 645 646 |
# File 'lib/flok/user_compiler.rb', line 644 def _services @_services end |
#macros ⇒ Object
Returns the value of attribute macros.
644 645 646 |
# File 'lib/flok/user_compiler.rb', line 644 def macros @macros end |
#name ⇒ Object
Returns the value of attribute name.
644 645 646 |
# File 'lib/flok/user_compiler.rb', line 644 def name @name end |
#spots(*spots) ⇒ Object
Names of spots
682 683 684 |
# File 'lib/flok/user_compiler.rb', line 682 def spots @spots end |
Instance Method Details
#action(name, &block) ⇒ Object
Pass through action
691 692 693 |
# File 'lib/flok/user_compiler.rb', line 691 def action name, &block @ctx.action self, name, &block end |
#choose_action(&block) ⇒ Object
677 678 679 |
# File 'lib/flok/user_compiler.rb', line 677 def choose_action &block @ctx.action self, :choose_action, &block end |
#macro(name, &block) ⇒ Object
Create an action macro
669 670 671 |
# File 'lib/flok/user_compiler.rb', line 669 def macro name, &block @macros[name] = block end |
#on_entry(str) ⇒ Object
673 674 675 |
# File 'lib/flok/user_compiler.rb', line 673 def on_entry str @_on_entry = _macro(str) end |
#services(*instance_names) ⇒ Object
686 687 688 |
# File 'lib/flok/user_compiler.rb', line 686 def services *instance_names @_services = instance_names.map{|e| e.to_s} end |