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
- #base_path(value = nil) ⇒ Object
- #engine(input_ext, engine_class, registered_opts = nil) ⇒ Object
- #files ⇒ Object
- #filter(&block) ⇒ Object
-
#initialize(path) ⇒ Source
constructor
A new instance of Source.
- #set_base_path(value) ⇒ Object
Constructor Details
#initialize(path) ⇒ Source
Returns a new instance of Source.
10 11 12 13 14 15 |
# File 'lib/dassets/source.rb', line 10 def initialize(path) @path = path.to_s @filter = proc{ |paths| paths } @engines = Hash.new{ |hash, key| hash[key] = [] } @response_headers = {} end |
Instance Attribute Details
#engines ⇒ Object (readonly)
Returns the value of attribute engines.
8 9 10 |
# File 'lib/dassets/source.rb', line 8 def engines @engines end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/dassets/source.rb', line 8 def path @path end |
#response_headers ⇒ Object (readonly)
Returns the value of attribute response_headers.
8 9 10 |
# File 'lib/dassets/source.rb', line 8 def response_headers @response_headers end |
Instance Method Details
#base_path(value = nil) ⇒ Object
17 18 19 20 |
# File 'lib/dassets/source.rb', line 17 def base_path(value = nil) set_base_path(value) unless value.nil? @base_path end |
#engine(input_ext, engine_class, registered_opts = nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/dassets/source.rb', line 30 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
36 37 38 |
# File 'lib/dassets/source.rb', line 36 def files apply_filter(glob_files || []).sort end |
#filter(&block) ⇒ Object
26 27 28 |
# File 'lib/dassets/source.rb', line 26 def filter(&block) block.nil? ? @filter : @filter = block end |
#set_base_path(value) ⇒ Object
22 23 24 |
# File 'lib/dassets/source.rb', line 22 def set_base_path(value) @base_path = value end |