Class: Decidim::ManifestMessages
- Inherits:
-
Object
- Object
- Decidim::ManifestMessages
show all
- Defined in:
- decidim-core/lib/decidim/manifest_messages.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ManifestMessages.
5
6
7
|
# File 'decidim-core/lib/decidim/manifest_messages.rb', line 5
def initialize
@store = {}
end
|
Instance Method Details
#has?(key) ⇒ Boolean
9
10
11
|
# File 'decidim-core/lib/decidim/manifest_messages.rb', line 9
def has?(key)
@store.has_key?(key)
end
|
#render(key, context = nil, **extra) ⇒ Object
19
20
21
|
# File 'decidim-core/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 'decidim-core/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
|