Sha256: 9bbfedc5fc082592336374073a890264329da244b7cf6bd333d0a485a80be6c9
Contents?: true
Size: 825 Bytes
Versions: 3
Compression:
Stored size: 825 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dassets-0.14.0 | lib/dassets/source.rb |
dassets-0.13.2 | lib/dassets/source.rb |
dassets-0.13.1 | lib/dassets/source.rb |