Class: Decidim::Assemblies::CurrentFeature
- Inherits:
-
Object
- Object
- Decidim::Assemblies::CurrentFeature
- Defined in:
- app/constraints/decidim/assemblies/current_feature.rb
Overview
This class infers the current feature on an assembly context request parameters and injects it into the environment.
Instance Method Summary collapse
-
#initialize(manifest) ⇒ CurrentFeature
constructor
Public: Initializes the class.
-
#matches?(request) ⇒ Boolean
Public: Matches the request against a feature and injects it into the environment.
Constructor Details
#initialize(manifest) ⇒ CurrentFeature
Public: Initializes the class.
manifest - The manifest of the feature to check against.
11 12 13 |
# File 'app/constraints/decidim/assemblies/current_feature.rb', line 11 def initialize(manifest) @manifest = manifest end |
Instance Method Details
#matches?(request) ⇒ Boolean
Public: Matches the request against a feature and injects it into the
environment.
request - The request that holds the current feature relevant information.
Returns a true if the request matches an assembly and a feature belonging to that assembly, false otherwise
22 23 24 25 |
# File 'app/constraints/decidim/assemblies/current_feature.rb', line 22 def matches?(request) CurrentAssembly.new.matches?(request) && Decidim::CurrentFeature.new(@manifest).matches?(request) end |