Class: Condenser::Rails::HelperAssetResolvers::Environment
- Inherits:
-
Object
- Object
- Condenser::Rails::HelperAssetResolvers::Environment
- Defined in:
- lib/condenser/rails/helper.rb
Overview
:nodoc:
Instance Method Summary collapse
- #asset_path(path) ⇒ Object
-
#initialize(view) ⇒ Environment
constructor
A new instance of Environment.
- #integrity(path) ⇒ Object
Constructor Details
#initialize(view) ⇒ Environment
Returns a new instance of Environment.
188 189 190 191 192 |
# File 'lib/condenser/rails/helper.rb', line 188 def initialize(view) raise ArgumentError, 'config.assets.resolve_with includes :environment, but app.assets is nil' unless view.assets @env = view.assets @precompiled_assets = view.assets_precompiled_regexes end |
Instance Method Details
#asset_path(path) ⇒ Object
194 195 196 197 198 199 200 201 |
# File 'lib/condenser/rails/helper.rb', line 194 def asset_path(path) if asset = @env.find(path) if !precompiled?(asset.filename) raise Condenser::Rails::AssetNotPrecompiledError.new(asset.filename) end asset.export.path end end |
#integrity(path) ⇒ Object
203 204 205 |
# File 'lib/condenser/rails/helper.rb', line 203 def integrity(path) @env.find(path)&.integrity end |