Class: Dynflow::Middleware::World
- Inherits:
 - 
      Object
      
        
- Object
 - Dynflow::Middleware::World
 
 
- Includes:
 - Algebrick::TypeCheck
 
- Defined in:
 - lib/dynflow/middleware/world.rb
 
Instance Method Summary collapse
- #clear_cache! ⇒ Object
 - #execute(method, action_or_class, *args, &block) ⇒ Object
 - 
  
    
      #initialize  ⇒ World 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of World.
 - #use(*args) ⇒ Object
 
Constructor Details
#initialize ⇒ World
Returns a new instance of World.
      7 8 9 10  | 
    
      # File 'lib/dynflow/middleware/world.rb', line 7 def initialize @register = Middleware::Register.new clear_cache! end  | 
  
Instance Method Details
#clear_cache! ⇒ Object
      34 35 36  | 
    
      # File 'lib/dynflow/middleware/world.rb', line 34 def clear_cache! @middleware_classes_cache = {} end  | 
  
#execute(method, action_or_class, *args, &block) ⇒ Object
      17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  | 
    
      # File 'lib/dynflow/middleware/world.rb', line 17 def execute(method, action_or_class, *args, &block) Match! method, :delay, :plan, :run, :finalize, :plan_phase, :finalize_phase, :present, :hook if Child? action_or_class, Dynflow::Action action = nil action_class = action_or_class elsif Type? action_or_class, Dynflow::Action action = action_or_class action_class = action.class else Algebrick::TypeCheck.error action_or_class, 'is not instance or child class', Dynflow::Action end classes = middleware_classes(action_class) stack = Middleware::Stack.build(classes, method, action, &block) stack.call(*args) end  | 
  
#use(*args) ⇒ Object
      12 13 14 15  | 
    
      # File 'lib/dynflow/middleware/world.rb', line 12 def use(*args) clear_cache! @register.use(*args) end  |