# encoding: utf-8 require 'singleton' module ClassyAssets class Config include Singleton attr_accessor :asset_debug, :asset_digest, :asset_host, :asset_paths, :asset_prefix, :asset_root def asset_debug @asset_debug.nil? ? (ENV['RACK_ENV'] == 'development') : @asset_debug end def asset_digest @asset_digest.nil? ? false : @asset_digest end def asset_paths @asset_paths ||= build_asset_paths @asset_paths.uniq! # ensure no duplicates @asset_paths end def asset_prefix @asset_prefix ||= 'assets' end def asset_root raise Errors::NilAssetRoot.new if @asset_root.nil? @asset_root end private def build_asset_paths Dir.glob(File.join(asset_root, asset_prefix, '*')) end end end