Class: Dassets::Source
- Inherits:
-
Object
- Object
- Dassets::Source
- Defined in:
- lib/dassets/source.rb
Instance Attribute Summary collapse
-
#engines ⇒ Object
readonly
Returns the value of attribute engines.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#response_headers ⇒ Object
readonly
Returns the value of attribute response_headers.
Instance Method Summary collapse
- #engine(input_ext, engine_class, registered_opts = nil) ⇒ Object
- #files ⇒ Object
- #filter(&block) ⇒ Object
-
#initialize(path) ⇒ Source
constructor
A new instance of Source.
Constructor Details
#initialize(path) ⇒ Source
Returns a new instance of Source.
8 9 10 11 12 13 |
# File 'lib/dassets/source.rb', line 8 def initialize(path) @path = path.to_s @filter = proc{ |paths| paths } @engines = Hash.new{ |h,k| Dassets::NullEngine.new } @response_headers = Hash.new end |
Instance Attribute Details
#engines ⇒ Object (readonly)
Returns the value of attribute engines.
6 7 8 |
# File 'lib/dassets/source.rb', line 6 def engines @engines end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/dassets/source.rb', line 6 def path @path end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
6 7 8 |
# File 'lib/dassets/source.rb', line 6 def response_headers @response_headers end |
Instance Method Details
#engine(input_ext, engine_class, registered_opts = nil) ⇒ Object
19 20 21 22 23 |
# File 'lib/dassets/source.rb', line 19 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 |
#files ⇒ Object
25 26 27 |
# File 'lib/dassets/source.rb', line 25 def files apply_filter(glob_files || []).sort end |
#filter(&block) ⇒ Object
15 16 17 |
# File 'lib/dassets/source.rb', line 15 def filter(&block) block.nil? ? @filter : @filter = block end |