Class: WebComponentsRails::HTMLBundleProcessor
- Inherits:
-
Object
- Object
- WebComponentsRails::HTMLBundleProcessor
- Defined in:
- lib/web_components_rails/html_bundle_processor.rb
Overview
Compresses HTML bundles
Constant Summary collapse
- VERSION =
'1'
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
readonly
Returns the value of attribute cache_key.
Class Method Summary collapse
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(options = {}) ⇒ HTMLBundleProcessor
constructor
A new instance of HTMLBundleProcessor.
Constructor Details
#initialize(options = {}) ⇒ HTMLBundleProcessor
Returns a new instance of HTMLBundleProcessor.
23 24 25 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 23 def initialize( = {}) @cache_key = [self.class.name, VERSION, , WebComponentsRails.optimize_scripts].freeze end |
Instance Attribute Details
#cache_key ⇒ Object (readonly)
Returns the value of attribute cache_key.
21 22 23 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 21 def cache_key @cache_key end |
Class Method Details
.cache_key ⇒ Object
17 18 19 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 17 def self.cache_key instance.cache_key end |
.call(input) ⇒ Object
13 14 15 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 13 def self.call(input) instance.call(input) end |
.instance ⇒ Object
9 10 11 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 9 def self.instance @instance ||= new end |
Instance Method Details
#call(input) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/web_components_rails/html_bundle_processor.rb', line 27 def call(input) # Sprockets::Environment for looking up assets, etc. @environment = input[:environment] @context = @environment.context_class.new(input) @data = input[:data] @data = process_bundle(@data) @context..merge(data: @data) end |