Sha256: a5b984af2231063bb3011163fc54b79265fbc8d7186709a0762db25eec9e6681

Contents?: true

Size: 976 Bytes

Versions: 23

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module ContextAnalyzers
      # Translates a decidim participatory_space to detected participatory spaces
      class ParticipatorySpaceAnalyzer
        def initialize(participatory_space)
          @participatory_space = participatory_space
          @context = {}
        end

        def self.context_for(participatory_space)
          analyzer = new participatory_space
          analyzer.extract_context!
          analyzer.context
        end

        attr_reader :participatory_space, :context

        def extract_context!
          return unless @participatory_space.respond_to? :manifest
          return unless @participatory_space.manifest.is_a? Decidim::ParticipatorySpaceManifest

          @context[:participatory_space_manifest] = @participatory_space.manifest.name.to_s
          @context[:participatory_space_slug] = @participatory_space&.slug
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.10.3 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.11.2 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.11.1 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.10.2 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.10.1 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.10.0 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.9.3 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.9.1 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.8.3 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.8.2 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.8.1 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.8.0 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.7.2 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.7.0 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.7 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.6 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.5 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.4 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.3 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
decidim-decidim_awesome-0.6.2 lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb