Sha256: fac44a5ce234fcb101a14a3663c70d1b66f3c32f87670e2489b6acb96c93fa72

Contents?: true

Size: 919 Bytes

Versions: 88

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    # This class infers the current component on an assembly context
    # request parameters and injects it into the environment.
    class CurrentComponent
      # Public: Initializes the class.
      #
      # manifest - The manifest of the component to check against.
      def initialize(manifest)
        @manifest = manifest
      end

      # Public: Matches the request against a component and injects it into the
      #         environment.
      #
      # request - The request that holds the current component relevant information.
      #
      # Returns a true if the request matches an assembly and a
      # component belonging to that assembly, false otherwise
      def matches?(request)
        CurrentAssembly.new.matches?(request) &&
          Decidim::CurrentComponent.new(@manifest).matches?(request)
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.4 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.27.9 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.29.0 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.3 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.27.8 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.29.0.rc4 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.29.0.rc3 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.29.0.rc2 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.29.0.rc1 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.2 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.27.7 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.1 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.27.6 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.26.10 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.26.9 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.0 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.27.5 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.0.rc5 app/constraints/decidim/assemblies/current_component.rb
decidim-assemblies-0.28.0.rc4 app/constraints/decidim/assemblies/current_component.rb