Class: SolidCacheDashboard::Decorators::CacheEntriesDecorator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/solid_cache_dashboard/decorators/cache_entries_decorator.rb

Instance Method Summary collapse

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_sizeObject



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_sizeObject



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