Sha256: a9594b6c3811c5ebfc45a1dc3cd31ed32340162243e4f32bf192569b63d3e7db

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/attribute_accessors'

module Cmor
  module Core
    module Backend
      module Configuration
        def configure
          yield self
        end

        mattr_accessor :registered_controllers do
          lambda do
            [
              # Cmor::Contact::Backend::FoosController
            ]
          end
        end

        mattr_accessor :registered_services do
          lambda do
            []
          end
        end

        mattr_accessor(:enable_active_storage_backend) { false }
        mattr_accessor(:enable_delayed_job_backend) { false }

        def self.registered_controllers
          rc = @@registered_controllers.call
          rc.reject! { |c| c.name =~ /.*ActiveStorage.*/ } unless enable_active_storage_backend
          rc.reject! { |c| c.name =~ /.*Delayed.*/ } unless enable_delayed_job_backend
          -> { rc }
        end

        mattr_accessor(:image_variant_options) {
          {
            gallery: { resize: "640x480" },
            table:   { resize: "160x120" }
          }
        }

        def self.image_variant_options_for(identifier)
          @@image_variant_options[identifier]
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cmor_core_backend-0.0.5.pre lib/cmor/core/backend/configuration.rb
cmor_core_backend-0.0.4.pre lib/cmor/core/backend/configuration.rb
cmor_core_backend-0.0.3.pre lib/cmor/core/backend/configuration.rb
cmor_core_backend-0.0.2.pre lib/cmor/core/backend/configuration.rb
cmor_core_backend-0.0.1.pre lib/cmor/core/backend/configuration.rb