Class: AssetLibrary
- Inherits:
-
Object
show all
- Defined in:
- lib/asset_library.rb,
lib/asset_library/util.rb,
lib/asset_library/asset.rb,
lib/asset_library/helpers.rb,
lib/asset_library/asset_module.rb
Defined Under Namespace
Modules: Helpers, Util
Classes: Asset, AssetModule
Class Method Summary
collapse
Class Method Details
.asset_module(key) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/asset_library.rb', line 57
def asset_module(key)
module_config = config[key.to_sym]
if module_config
AssetModule.new(module_config)
end
end
|
.cache ⇒ Object
29
30
31
32
|
# File 'lib/asset_library.rb', line 29
def cache
return true if @cache.nil?
@cache
end
|
.cache=(cache) ⇒ Object
34
35
36
37
38
|
# File 'lib/asset_library.rb', line 34
def cache=(cache)
@config = nil
@cache_vars = nil
@cache = cache
end
|
.cache_vars ⇒ Object
40
41
42
43
|
# File 'lib/asset_library.rb', line 40
def cache_vars
@cache_vars ||= {}
end
|
.config ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/asset_library.rb', line 45
def config
return @config if cache && @config
ret = if File.exist?(config_path)
yaml = YAML.load_file(config_path) || {}
Util::symbolize_hash_keys(yaml)
else
{}
end
@config = cache ? ret : nil
ret
end
|
.config_path ⇒ Object
13
14
15
|
# File 'lib/asset_library.rb', line 13
def config_path
@config_path
end
|
.config_path=(config_path) ⇒ Object
17
18
19
|
# File 'lib/asset_library.rb', line 17
def config_path=(config_path)
@config_path = config_path
end
|
.root ⇒ Object
21
22
23
|
# File 'lib/asset_library.rb', line 21
def root
@root
end
|
.root=(root) ⇒ Object
25
26
27
|
# File 'lib/asset_library.rb', line 25
def root=(root)
@root = root
end
|
.write_all_caches ⇒ Object
64
65
66
67
68
69
|
# File 'lib/asset_library.rb', line 64
def write_all_caches
config.keys.each do |key|
m = asset_module(key)
m.write_all_caches
end
end
|