Class: Decidim::Importers::ImportManifest::Messages
- Inherits:
-
Object
- Object
- Decidim::Importers::ImportManifest::Messages
- Defined in:
- lib/decidim/importers/import_manifest.rb
Instance Method Summary collapse
- #has?(key) ⇒ Boolean
-
#initialize ⇒ Messages
constructor
A new instance of Messages.
- #render(key, context = nil, **extra) ⇒ Object
- #set(key, &block) ⇒ Object
Constructor Details
#initialize ⇒ Messages
Returns a new instance of Messages.
116 117 118 |
# File 'lib/decidim/importers/import_manifest.rb', line 116 def initialize @store = {} end |
Instance Method Details
#has?(key) ⇒ Boolean
120 121 122 |
# File 'lib/decidim/importers/import_manifest.rb', line 120 def has?(key) @store.has_key?(key) end |
#render(key, context = nil, **extra) ⇒ Object
130 131 132 |
# File 'lib/decidim/importers/import_manifest.rb', line 130 def render(key, context = nil, **extra) context.instance_exec(**extra, &@store[key]) if @store[key] end |
#set(key, &block) ⇒ Object
124 125 126 127 128 |
# File 'lib/decidim/importers/import_manifest.rb', line 124 def set(key, &block) raise ArgumentError, "You need to provide a block for the message." unless block_given? @store[key] = block end |