Class: SolidCacheDashboard::Decorators::CacheEntriesDecorator
- Inherits:
-
Object
- Object
- SolidCacheDashboard::Decorators::CacheEntriesDecorator
- Includes:
- Enumerable
- Defined in:
- lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #human_total_size ⇒ Object
-
#initialize(entries) ⇒ CacheEntriesDecorator
constructor
A new instance of CacheEntriesDecorator.
- #total_size ⇒ Object
Constructor Details
#initialize(entries) ⇒ CacheEntriesDecorator
Returns a new instance of CacheEntriesDecorator.
8 9 10 |
# File 'lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb', line 8 def initialize(entries) @entries = entries end |
Instance Method Details
#each(&block) ⇒ Object
12 13 14 15 16 |
# File 'lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb', line 12 def each(&block) @entries.each do |entry| block.call(SolidCacheDashboard.decorate(entry)) end end |
#human_total_size ⇒ Object
22 23 24 |
# File 'lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb', line 22 def human_total_size ActiveSupport::NumberHelper.number_to_human_size(total_size) end |
#total_size ⇒ Object
18 19 20 |
# File 'lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb', line 18 def total_size @total_size ||= @entries.sum(:byte_size) end |