Sha256: 6f59ec56dd289c674fcace8fbf43501e59f1984a916187da16bbe86f6ea35ee9
Contents?: true
Size: 856 Bytes
Versions: 5
Compression:
Stored size: 856 Bytes
Contents
require 'dassets/engine' module Dassets; end class Dassets::Source attr_reader :path, :engines, :response_headers def initialize(path) @path = path.to_s @filter = proc{ |paths| paths } @engines = Hash.new{ |h,k| Dassets::NullEngine.new } @response_headers = Hash.new end def filter(&block) block.nil? ? @filter : @filter = block end def engine(input_ext, engine_class, registered_opts=nil) default_opts = { 'source_path' => @path } engine_opts = default_opts.merge(registered_opts || {}) @engines[input_ext.to_s] = engine_class.new(engine_opts) end def files apply_filter(glob_files || []).sort end private def glob_files Dir.glob(File.join(@path, "**/*")).reject!{ |p| !File.file?(p) } end def apply_filter(files) @filter.call(files) end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
dassets-0.14.5 | lib/dassets/source.rb |
dassets-0.14.4 | lib/dassets/source.rb |
dassets-0.14.3 | lib/dassets/source.rb |
dassets-0.14.2 | lib/dassets/source.rb |
dassets-0.14.1 | lib/dassets/source.rb |