Exception: Assets::Minify::Logger
- Inherits:
-
StandardError
- Object
- StandardError
- Assets::Minify::Logger
- Defined in:
- lib/assets/minify/logger.rb
Instance Attribute Summary collapse
-
#after_size ⇒ Object
Returns the value of attribute after_size.
-
#before_size ⇒ Object
Returns the value of attribute before_size.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#total_after_size ⇒ Object
Returns the value of attribute total_after_size.
-
#total_before_size ⇒ Object
Returns the value of attribute total_before_size.
Instance Method Summary collapse
- #finished ⇒ Object
-
#initialize ⇒ Logger
constructor
A new instance of Logger.
- #minified ⇒ Object
- #start(file_path) ⇒ Object
Constructor Details
#initialize ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 |
# File 'lib/assets/minify/logger.rb', line 8 def initialize @total_after_size = 0 @total_before_size = 0 end |
Instance Attribute Details
#after_size ⇒ Object
Returns the value of attribute after_size.
5 6 7 |
# File 'lib/assets/minify/logger.rb', line 5 def after_size @after_size end |
#before_size ⇒ Object
Returns the value of attribute before_size.
5 6 7 |
# File 'lib/assets/minify/logger.rb', line 5 def before_size @before_size end |
#file_path ⇒ Object
Returns the value of attribute file_path.
5 6 7 |
# File 'lib/assets/minify/logger.rb', line 5 def file_path @file_path end |
#total_after_size ⇒ Object
Returns the value of attribute total_after_size.
5 6 7 |
# File 'lib/assets/minify/logger.rb', line 5 def total_after_size @total_after_size end |
#total_before_size ⇒ Object
Returns the value of attribute total_before_size.
5 6 7 |
# File 'lib/assets/minify/logger.rb', line 5 def total_before_size @total_before_size end |
Instance Method Details
#finished ⇒ Object
25 26 27 |
# File 'lib/assets/minify/logger.rb', line 25 def finished logger.info "Total minify ratio #{@total_before_size} to #{@total_after_size} (#{@total_after_size > 0 ? 100 - (@total_before_size.to_f / @total_after_size).round(2) : '-'}%)" end |
#minified ⇒ Object
19 20 21 22 23 |
# File 'lib/assets/minify/logger.rb', line 19 def minified @after_size = File.size(@file_path) @total_after_size += @after_size logger.info "Minify #{@file_path} #{@before_size} to #{@after_size} (#{@after_size > 0 ? 100 - @before_size / @after_size : '-'}%)" end |
#start(file_path) ⇒ Object
13 14 15 16 17 |
# File 'lib/assets/minify/logger.rb', line 13 def start(file_path) @file_path = file_path @before_size = File.size(file_path) @total_before_size += @before_size end |