Module: ViewHelpers
- Included in:
- Mako::Core
- Defined in:
- lib/mako/view_helpers.rb
Instance Method Summary collapse
-
#last_updated ⇒ String
Returns the current time in month day year hour:minute:second format.
-
#quick_nav(feeds) ⇒ String
Returns a string with anchor tag links to each Feed generated on the page.
-
#today ⇒ String
Returns today’s date in Day, Date Month Year format.
Instance Method Details
#last_updated ⇒ String
Returns the current time in month day year hour:minute:second format
14 15 16 |
# File 'lib/mako/view_helpers.rb', line 14 def last_updated Time.now.strftime('%d %b %Y %H:%M:%S') end |
#quick_nav(feeds) ⇒ String
Returns a string with anchor tag links to each Feed generated on the page
21 22 23 24 25 26 27 |
# 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 ⇒ String
Returns today’s date in Day, Date Month Year format
7 8 9 |
# File 'lib/mako/view_helpers.rb', line 7 def today Time.now.strftime('%A, %d %B %Y') end |