Class: Decidim::Core::ParticipatorySpaceFinderBase
- Inherits:
-
GraphQL::Function
- Object
- GraphQL::Function
- Decidim::Core::ParticipatorySpaceFinderBase
- Defined in:
- app/functions/decidim/core/participatory_space_finder_base.rb
Overview
An abstract base class resolver for the GraphQL endpoint for a single participatory space Inherit from this class and add search arguments to create finder participatory classes as is shown in ParticipatorySpaceFinder
Direct Known Subclasses
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Instance Method Summary collapse
- #call(_obj, args, ctx) ⇒ Object
-
#initialize(manifest:) ⇒ ParticipatorySpaceFinderBase
constructor
A new instance of ParticipatorySpaceFinderBase.
-
#model_class ⇒ Object
lazy instantation of the class.
Constructor Details
#initialize(manifest:) ⇒ ParticipatorySpaceFinderBase
Returns a new instance of ParticipatorySpaceFinderBase.
11 12 13 |
# File 'app/functions/decidim/core/participatory_space_finder_base.rb', line 11 def initialize(manifest:) @manifest = manifest end |
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
9 10 11 |
# File 'app/functions/decidim/core/participatory_space_finder_base.rb', line 9 def manifest @manifest end |
Instance Method Details
#call(_obj, args, ctx) ⇒ Object
20 21 22 23 24 25 26 |
# File 'app/functions/decidim/core/participatory_space_finder_base.rb', line 20 def call(_obj, args, ctx) query = { organization: ctx[:current_organization] } args.keys.each do |key| query[key] = args[key] end model_class.public_spaces.find_by(query) end |
#model_class ⇒ Object
lazy instantation of the class
16 17 18 |
# File 'app/functions/decidim/core/participatory_space_finder_base.rb', line 16 def model_class @model_class ||= manifest.model_class_name.constantize end |