Sha256: d56d8f71b24ddbbca9a66302814458025f62102cc38b74826aadc2d641c9eca5

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 Bytes

Contents

# 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 || (ENV['RACK_ENV'] == 'development')
    end

    def asset_digest
      @asset_digest || false
    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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
classy_assets-0.6.2 lib/classy_assets/config.rb