Sha256: b6268ede6728a049881fe4da23f862feef3278ca878d1383d39918235c0c07d6

Contents?: true

Size: 920 Bytes

Versions: 2

Compression:

Stored size: 920 Bytes

Contents

module Distribuo
  class Configuration
    attr_accessor :admin_authentication_module, :base_controller
    attr_writer :logger, :admin_mount_point, :current_mobiliable, :mobiliable_objects

    def initialize
      @logger = Logger.new(STDOUT)
      @logger.level = Logger::INFO
      @base_controller = '::ApplicationController'
    end

    # logger [Object].
    def logger
      @logger.is_a?(Proc) ? instance_exec(&@logger) : @logger
    end

    # admin_mount_point [String].
    def admin_mount_point
      @admin_mount_point ||= '/distribuo'
    end

    # Only used to limit what users can see when using admin
    def mobiliable_objects
      [*instance_exec(&@mobiliable_objects)] if @mobiliable_objects
    end

    # Used to set current scribable, used when creating new sites or importing sites
    def current_mobiliable
      instance_exec(&@current_mobiliable) if @current_mobiliable
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
distribuo-0.1.16 lib/distribuo/configuration.rb
distribuo-0.1.8 lib/distribuo/configuration.rb