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
- #type(path) ⇒ Object
Constructor Details
#initialize(view) ⇒ Environment
Returns a new instance of Environment.
233 234 235 236 237 |
# File 'lib/condenser/rails/helper.rb', line 233 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
239 240 241 242 243 244 245 246 |
# File 'lib/condenser/rails/helper.rb', line 239 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
248 249 250 |
# File 'lib/condenser/rails/helper.rb', line 248 def integrity(path) @env.find(path)&.export&.integrity end |
#type(path) ⇒ Object
252 253 254 |
# File 'lib/condenser/rails/helper.rb', line 252 def type(path) @env.find(path)&.export&.type end |