Module: ViewHelpers

Defined in:
lib/serve/templates/default/views/view_helpers.rb

Overview

Methods placed in this module can be used inside of any view. View helpers allow you to encapsalate complex logic and keep your views pristine.

Instance Method Summary collapse

Instance Method Details

Calculate the years for a copyright



9
10
11
12
13
14
15
16
# File 'lib/serve/templates/default/views/view_helpers.rb', line 9

def copyright_years(start_year)
  end_year = Date.today.year
  if start_year == end_year
    "#{start_year}"
  else
    "#{start_year}–#{end_year}"
  end
end

#hidden(&block) ⇒ Object

Handy for hiding a block of unfinished code



19
20
21
# File 'lib/serve/templates/default/views/view_helpers.rb', line 19

def hidden(&block)
  #no-op
end