Class: SolidCacheDashboard::Decorators::CacheEventDecorator
- Inherits:
-
Object
- Object
- SolidCacheDashboard::Decorators::CacheEventDecorator
- Defined in:
- lib/solid_cache_dashboard/decorators/cache_event_decorator.rb
Instance Method Summary collapse
- #byte_size ⇒ Object
- #color ⇒ Object
- #created_at ⇒ Object
- #created_at_ago ⇒ Object
- #duration ⇒ Object
- #event_type ⇒ Object
- #human_byte_size ⇒ Object
- #human_duration ⇒ Object
- #id ⇒ Object
-
#initialize(event) ⇒ CacheEventDecorator
constructor
A new instance of CacheEventDecorator.
- #key_hash ⇒ Object
- #key_string ⇒ Object
Constructor Details
#initialize(event) ⇒ CacheEventDecorator
Returns a new instance of CacheEventDecorator.
4 5 6 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 4 def initialize(event) @event = event end |
Instance Method Details
#byte_size ⇒ Object
24 25 26 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 24 def byte_size @event.byte_size end |
#color ⇒ Object
46 47 48 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 46 def color @event.color end |
#created_at ⇒ Object
42 43 44 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 42 def created_at @event.created_at end |
#created_at_ago ⇒ Object
50 51 52 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 50 def created_at_ago time_ago_in_words(created_at) end |
#duration ⇒ Object
33 34 35 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 33 def duration @event.duration end |
#event_type ⇒ Object
12 13 14 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 12 def event_type @event.event_type end |
#human_byte_size ⇒ Object
28 29 30 31 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 28 def human_byte_size return nil unless @event.byte_size ActiveSupport::NumberHelper.number_to_human_size(@event.byte_size) end |
#human_duration ⇒ Object
37 38 39 40 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 37 def human_duration return nil unless @event.duration "#{(@event.duration * 1000).round(2)} ms" end |
#id ⇒ Object
8 9 10 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 8 def id @event.id end |
#key_hash ⇒ Object
16 17 18 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 16 def key_hash @event.key_hash end |
#key_string ⇒ Object
20 21 22 |
# File 'lib/solid_cache_dashboard/decorators/cache_event_decorator.rb', line 20 def key_string @event.key_string || @event.key_hash.to_s end |