Class: Hanami::Assets::Bundler::Compressor Private
- Inherits:
-
Object
- Object
- Hanami::Assets::Bundler::Compressor
- Defined in:
- lib/hanami/assets/bundler/compressor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Compresses a JS or CSS file
Constant Summary collapse
- JAVASCRIPT_EXT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.js'.freeze
- STYLESHEET_EXT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'.css'.freeze
Instance Method Summary collapse
-
#compress ⇒ String?
private
The compressed contents of the file OR nil if it’s not compressable.
-
#initialize(path, configuration) ⇒ Compressor
constructor
private
Return a new instance.
Constructor Details
#initialize(path, configuration) ⇒ Compressor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a new instance
21 22 23 24 |
# File 'lib/hanami/assets/bundler/compressor.rb', line 21 def initialize(path, configuration) @path = path @configuration = configuration end |
Instance Method Details
#compress ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the compressed contents of the file OR nil if it’s not compressable.
30 31 32 33 34 35 |
# File 'lib/hanami/assets/bundler/compressor.rb', line 30 def compress case File.extname(@path) when JAVASCRIPT_EXT then _compress(compressor(:js)) when STYLESHEET_EXT then _compress(compressor(:css)) end end |