Class: JsRender::Rails::AssetFinder
- Inherits:
-
AssetFinder::Base
- Object
- AssetFinder::Base
- JsRender::Rails::AssetFinder
- Defined in:
- lib/js_render/rails/asset_finder.rb
Instance Method Summary collapse
-
#initialize ⇒ AssetFinder
constructor
A new instance of AssetFinder.
- #read(path) ⇒ Object
Methods inherited from AssetFinder::Base
Constructor Details
#initialize ⇒ AssetFinder
Returns a new instance of AssetFinder.
4 5 6 7 8 |
# File 'lib/js_render/rails/asset_finder.rb', line 4 def initialize super @environment = ::Rails.application.assets @manifest = ::Rails.application.assets_manifest end |
Instance Method Details
#read(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/js_render/rails/asset_finder.rb', line 10 def read(path) logical_path = path.gsub('app/assets/javascripts/', '') if @environment @environment[logical_path].to_s elsif @manifest.assets[logical_path] relative_path = @manifest.assets[logical_path] full_path = File.join(@manifest.dir, relative_path) File.read full_path else super path end end |