Module: Jammit::Lite
- Defined in:
- lib/jammit_lite.rb,
lib/jammit/lite/asset.rb,
lib/jammit/lite/helper.rb,
lib/jammit/lite/routes.rb
Defined Under Namespace
Modules: Helper, Routes Classes: Asset
Class Method Summary collapse
-
.asset_hash ⇒ Object
returns hash from config/assets.yml expands all wildcard paths.
-
.assets(type) ⇒ Object
returns hash of bundle file arrays keyed by bundle name.
Class Method Details
.asset_hash ⇒ Object
returns hash from config/assets.yml expands all wildcard paths
18 19 20 21 22 23 24 |
# File 'lib/jammit_lite.rb', line 18 def self.asset_hash yaml = File.open("#{Rails.root}/config/assets.yml") hash = YAML::load(yaml).symbolize_keys hash.each do |key,bundles| bundles.each { |name,files| bundles[name] = Jammit::Lite::Bundle.(files) } end end |
.assets(type) ⇒ Object
returns hash of bundle file arrays keyed by bundle name
6 7 8 9 10 11 12 13 |
# File 'lib/jammit_lite.rb', line 6 def self.assets(type) hash = asset_hash[type].symbolize_keys assets = hash.inject({}) do |out,array| key,paths = array out[key] = paths.map { |path| Jammit::Lite::Asset.new(path) } out end end |