Module: SolidWebUi::Cache::ApplicationHelper

Defined in:
app/helpers/solid_web_ui/cache/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#cache_nav(active) ⇒ Object



5
6
7
8
9
10
# File 'app/helpers/solid_web_ui/cache/application_helper.rb', line 5

def cache_nav(active)
  [
    { label: "Dashboard", href: root_path, active: active == :dashboard },
    { label: "Entries", href: entries_path, active: active == :entries }
  ]
end

#readable_key(key) ⇒ Object

Cache keys are stored as binary; present them as readable, truncated text.



13
14
15
# File 'app/helpers/solid_web_ui/cache/application_helper.rb', line 13

def readable_key(key)
  truncate(key.to_s.dup.force_encoding("UTF-8").scrub("?"), length: 80)
end

#short_time(time) ⇒ Object



17
18
19
20
21
# File 'app/helpers/solid_web_ui/cache/application_helper.rb', line 17

def short_time(time)
  return "" if time.nil?

  time.in_time_zone(SolidWebUi::Cache.config.time_zone).strftime("%Y-%m-%d %H:%M:%S")
end