Sha256: 628ae4df7539d7af5ac89c5c63c96aed1d2860148d2f3b24460da15923decc75

Contents?: true

Size: 939 Bytes

Versions: 18

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true

module Cmor::Seo
  module Configuration
    def configure
      yield self
    end

    mattr_accessor :resources_controllers do
      -> { [] }
    end

    mattr_accessor :resource_controllers do
      -> { [] }
    end

    mattr_accessor :service_controllers do
      -> { [] }
    end

    mattr_accessor :sidebar_controllers do
      -> { [] }
    end

    mattr_accessor :resources do
      {}
    end

    mattr_accessor :handle_seoable_after_save_exception do
      ->(exception) { raise exception }
    end

    def self.resources_autocomplete_options
      resources.each_with_object({}) { |(k, v), m| m[k] = v.fetch(:autocomplete_options) { {} } }
    end

    def add_resource(class_name, options = {})
      @@resources[class_name] = options
    end

    def remove_resource(*class_names)
      class_names.each do |class_name|
        @resources.delete(class_name)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cmor_seo-0.0.60.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.59.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.58.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.57.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.56.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.55.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.54.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.53.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.52.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.51.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.50.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.49.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.48.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.45.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.44.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.43.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.42.pre lib/cmor/seo/configuration.rb
cmor_seo-0.0.41.pre lib/cmor/seo/configuration.rb