Class: Dassets::Config
- Inherits:
-
Object
- Object
- Dassets::Config
- Defined in:
- lib/dassets/config.rb
Instance Attribute Summary collapse
-
#combinations ⇒ Object
readonly
Returns the value of attribute combinations.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Instance Method Summary collapse
- #base_url(value = nil) ⇒ Object
- #combination(key_digest_path, value_digest_paths) ⇒ Object
- #combination?(key_digest_path) ⇒ Boolean
- #content_cache(cache = nil) ⇒ Object
- #file_store(value = nil) ⇒ Object
- #fingerprint_cache(cache = nil) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset ⇒ Object
- #set_base_url(value) ⇒ Object
- #source(path, &block) ⇒ Object
Constructor Details
Instance Attribute Details
#combinations ⇒ Object (readonly)
Returns the value of attribute combinations.
11 12 13 |
# File 'lib/dassets/config.rb', line 11 def combinations @combinations end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
11 12 13 |
# File 'lib/dassets/config.rb', line 11 def sources @sources end |
Instance Method Details
#base_url(value = nil) ⇒ Object
28 29 30 31 |
# File 'lib/dassets/config.rb', line 28 def base_url(value = nil) set_base_url(value) unless value.nil? @base_url end |
#combination(key_digest_path, value_digest_paths) ⇒ Object
63 64 65 |
# File 'lib/dassets/config.rb', line 63 def combination(key_digest_path, value_digest_paths) @combinations[key_digest_path.to_s] = [*value_digest_paths] end |
#combination?(key_digest_path) ⇒ Boolean
67 68 69 70 71 |
# File 'lib/dassets/config.rb', line 67 def combination?(key_digest_path) # a digest path is only considered a combination is it is not the default # pass-thru above @combinations[key_digest_path.to_s] != [key_digest_path] end |
#content_cache(cache = nil) ⇒ Object
49 50 51 52 |
# File 'lib/dassets/config.rb', line 49 def content_cache(cache = nil) @content_cache = cache unless cache.nil? @content_cache end |
#file_store(value = nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/dassets/config.rb', line 37 def file_store(value = nil) unless value.nil? @file_store = if value.is_a?(Dassets::FileStore) value else Dassets::FileStore.new(value) end end @file_store end |
#fingerprint_cache(cache = nil) ⇒ Object
54 55 56 57 |
# File 'lib/dassets/config.rb', line 54 def fingerprint_cache(cache = nil) @fingerprint_cache = cache unless cache.nil? @fingerprint_cache end |
#reset ⇒ Object
22 23 24 25 26 |
# File 'lib/dassets/config.rb', line 22 def reset @sources = [] @combinations = Hash.new{ |_h, k| [k] } # digest pass-thru if none defined @file_store = Dassets::NullFileStore.new end |
#set_base_url(value) ⇒ Object
33 34 35 |
# File 'lib/dassets/config.rb', line 33 def set_base_url(value) @base_url = value end |