Module: SolidStackWeb::ApplicationHelper

Defined in:
app/helpers/solid_stack_web/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_duration(seconds) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/solid_stack_web/application_helper.rb', line 3

def format_duration(seconds)
  s = seconds.to_i
  return "#{s}s"          if s < 60
  return "#{s / 60}m #{s % 60}s" if s < 3600

  "#{s / 3600}h #{(s % 3600) / 60}m"
end

#inline_stylesObject



11
12
13
14
15
# File 'app/helpers/solid_stack_web/application_helper.rb', line 11

def inline_styles
  dir = SolidStackWeb::Engine.root.join("app/assets/stylesheets/solid_stack_web")
  css = dir.glob("_*.css").sort.map(&:read).join("\n")
  (:style, css.html_safe)
end