Class: Dassets::Config

Inherits:
Object
  • Object
show all
Includes:
NsOptions::Proxy
Defined in:
lib/dassets/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



17
18
19
20
21
# File 'lib/dassets/config.rb', line 17

def initialize
  super
  @sources = []
  @combinations = Hash.new{ |h, k| [k] } # digest pass-thru if none defined
end

Instance Attribute Details

#combinationsObject (readonly)

Returns the value of attribute combinations.



15
16
17
# File 'lib/dassets/config.rb', line 15

def combinations
  @combinations
end

#sourcesObject (readonly)

Returns the value of attribute sources.



15
16
17
# File 'lib/dassets/config.rb', line 15

def sources
  @sources
end

Instance Method Details

#base_url(value = nil) ⇒ Object



23
24
25
26
# File 'lib/dassets/config.rb', line 23

def base_url(value = nil)
  set_base_url(value) if !value.nil?
  @base_url
end

#combination(key_digest_path, value_digest_paths) ⇒ Object



36
37
38
# File 'lib/dassets/config.rb', line 36

def combination(key_digest_path, value_digest_paths)
  @combinations[key_digest_path.to_s] = [*value_digest_paths]
end

#combination?(key_digest_path) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
44
# File 'lib/dassets/config.rb', line 40

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

#set_base_url(value) ⇒ Object



28
29
30
# File 'lib/dassets/config.rb', line 28

def set_base_url(value)
  @base_url = value
end

#source(path, &block) ⇒ Object



32
33
34
# File 'lib/dassets/config.rb', line 32

def source(path, &block)
  @sources << Source.new(path).tap{ |s| block.call(s) if block }
end