Module: WithEmbeddedAssets::Mixin
- Included in:
- ViewHelpers
- Defined in:
- lib/with_embedded_assets/mixin.rb
Overview
This mixin declares the method that can be used to temporarily set embedded assets in a HTML compiled by ActionView on Rails.
Instance Method Summary collapse
-
#with_embedded_assets ⇒ Object
Activates the embedding of assets during the execution of a block.
Instance Method Details
#with_embedded_assets ⇒ Object
Activates the embedding of assets during the execution of a block.
After the block finishes the state of the automatic embedding is returned to its previous state before the method was called.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/with_embedded_assets/mixin.rb', line 10 def previous_state = WithEmbeddedAssets.enabled? WithEmbeddedAssets.enabled = true return_value = nil begin return_value = yield ensure WithEmbeddedAssets.enabled = previous_state end return_value end |