Class: Decidim::ManifestMessages
  
  
  
  
  
    - Inherits:
 
    - 
      Object
      
        
          - Object
 
          
            - Decidim::ManifestMessages
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/decidim/manifest_messages.rb
 
  
  
 
  
    
      Instance Method Summary
      collapse
    
    
  
  Constructor Details
  
    
  
  
    
Returns a new instance of ManifestMessages.
   
 
  
  
    
      
5
6
7 
     | 
    
      # File 'lib/decidim/manifest_messages.rb', line 5
def initialize
  @store = {}
end
     | 
  
 
  
 
  
    Instance Method Details
    
      
  
  
    #has?(key)  ⇒ Boolean 
  
  
  
  
    
      
9
10
11 
     | 
    
      # File 'lib/decidim/manifest_messages.rb', line 9
def has?(key)
  @store.has_key?(key)
end 
     | 
  
 
    
      
  
  
    #render(key, context = nil)  ⇒ Object 
  
  
  
  
    
      
19
20
21 
     | 
    
      # File 'lib/decidim/manifest_messages.rb', line 19
def render(key, context = nil, **)
  context.instance_exec(**, &@store[key]) if @store[key]
end 
     | 
  
 
    
      
  
  
    #set(key, &block)  ⇒ Object 
  
  
  
  
    
      
13
14
15
16
17 
     | 
    
      # File 'lib/decidim/manifest_messages.rb', line 13
def set(key, &block)
  raise ArgumentError, "You need to provide a block for the message." unless block_given?
  @store[key] = block
end 
     |