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
- #unregister_workflow(manifest) ⇒ Object
- #workflow_collection ⇒ Object
Instance Method Details
#add_workflow(manifest) ⇒ Object
21 22 23 24 |
# File 'lib/decidim/verifications/registry.rb', line 21 def add_workflow(manifest) manifest.validate! workflow_collection.add(manifest) end |
#clear_workflows ⇒ Object
26 27 28 |
# File 'lib/decidim/verifications/registry.rb', line 26 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
30 31 32 33 34 35 36 |
# File 'lib/decidim/verifications/registry.rb', line 30 def reset_workflows(*manifests) clear_workflows manifests.each do |manifest| add_workflow(manifest) end end |
#unregister_workflow(manifest) ⇒ Object
17 18 19 |
# File 'lib/decidim/verifications/registry.rb', line 17 def unregister_workflow(manifest) workflow_collection.delete(manifest) end |
#workflow_collection ⇒ Object
38 39 40 |
# File 'lib/decidim/verifications/registry.rb', line 38 def workflow_collection @workflow_collection ||= Set.new end |