Class: Decidim::ViewHooks::ViewHook
- Inherits:
 - 
      Object
      
        
- Object
 - Decidim::ViewHooks::ViewHook
 
 
- Defined in:
 - lib/decidim/view_hooks.rb
 
Overview
Internal class to encapsulate each view registered on a view hook.
Instance Attribute Summary collapse
- 
  
    
      #priority  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute priority.
 
Instance Method Summary collapse
- 
  
    
      #initialize(priority, block)  ⇒ ViewHook 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
priority - a Number (Integer|Float) to sort the block.
 - 
  
    
      #render(view_context)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Public: renders the block inside the view context.
 
Constructor Details
#initialize(priority, block) ⇒ ViewHook
priority - a Number (Integer|Float) to sort the block. block - a block that will be rendered in a view context.
      91 92 93 94  | 
    
      # File 'lib/decidim/view_hooks.rb', line 91 def initialize(priority, block) @priority = priority @block = block end  | 
  
Instance Attribute Details
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
      96 97 98  | 
    
      # File 'lib/decidim/view_hooks.rb', line 96 def priority @priority end  | 
  
Instance Method Details
#render(view_context) ⇒ Object
Public: renders the block inside the view context.
view_context - a context to render the view hook.
Returns a String.
      103 104 105  | 
    
      # File 'lib/decidim/view_hooks.rb', line 103 def render(view_context) @block.call(view_context) end  |