module ViewHelpers

Public Instance Methods

last_updated() click to toggle source

Returns the current time in month day year hour:minute:second format

@return [String]

# File lib/mako/view_helpers.rb, line 14
def last_updated
  Time.now.strftime('%d %b %Y %H:%M:%S')
end
quick_nav(feeds) click to toggle source

Returns a string with anchor tag links to each Feed generated on the page

@return [String]

# File lib/mako/view_helpers.rb, line 21
def quick_nav(feeds)
  feeds.select { |feed| feed.articles.size.positive? }
       .each_with_index.inject('') do |string, (feed, index)|
    string += "<a href='#feed-#{index}' class='quick-nav-item'>#{feed.title} <div class='circle'>#{feed.articles.size}</div></a>"
    string
  end
end
today() click to toggle source

Returns today's date in Day, Date Month Year format

@return [String]

# File lib/mako/view_helpers.rb, line 7
def today
  Time.now.strftime('%A, %d %B %Y')
end