Class: Decidim::Verifications::Registry
- Inherits:
-
Object
- Object
- Decidim::Verifications::Registry
- Defined in:
- lib/decidim/verifications/registry.rb
Overview
Takes care of holding and accessing verification methods.
Instance Method Summary collapse
- #add_workflow(manifest) ⇒ Object
- #clear_workflows ⇒ Object
- #register_workflow(name) {|manifest| ... } ⇒ Object
- #reset_workflows(*manifests) ⇒ Object
- #workflow_collection ⇒ Object
Instance Method Details
#add_workflow(manifest) ⇒ Object
17 18 19 20 |
# File 'lib/decidim/verifications/registry.rb', line 17 def add_workflow(manifest) manifest.validate! workflow_collection.add(manifest) end |
#clear_workflows ⇒ Object
22 23 24 |
# File 'lib/decidim/verifications/registry.rb', line 22 def clear_workflows workflow_collection.clear end |
#register_workflow(name) {|manifest| ... } ⇒ Object
11 12 13 14 15 |
# File 'lib/decidim/verifications/registry.rb', line 11 def register_workflow(name) manifest = WorkflowManifest.new(name: name.to_s) yield(manifest) add_workflow(manifest) end |
#reset_workflows(*manifests) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/decidim/verifications/registry.rb', line 26 def reset_workflows(*manifests) clear_workflows manifests.each do |manifest| add_workflow(manifest) end end |
#workflow_collection ⇒ Object
34 35 36 |
# File 'lib/decidim/verifications/registry.rb', line 34 def workflow_collection @workflow_collection ||= Set.new end |