Class: Tumblargh::Renderer::Blocks::Date
- Inherits:
-
Base
- Object
- Tumblargh::Renderer::Base
- Base
- Tumblargh::Renderer::Blocks::Date
- Defined in:
- lib/tumblargh/renderer/blocks/dates.rb
Overview
Rendered for all posts. Always wrap dates in this block so they will be properly hidden on non-post pages.
Constant Summary collapse
- MAP =
{ # Tumblr tag => strftime symbol :day_of_month => '-d', :day_of_month_with_zero => :d, :day_of_week => :A, :short_day_of_week => :a, :day_of_week_number => :u, :day_of_year => '-j', :week_of_year => '-V', :month => :B, :short_month => :b, :month_number => '-m', :month_number_with_zero => :m }
Instance Attribute Summary
Attributes inherited from Tumblargh::Renderer::Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from Tumblargh::Renderer::Base
#context_post, contextual_tag, #escape_html, #escape_url, #initialize, #method_missing, #render, #strip_html
Constructor Details
This class inherits a constructor from Tumblargh::Renderer::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tumblargh::Renderer::Base
Instance Method Details
#day_of_month_suffix ⇒ Object
32 33 34 |
# File 'lib/tumblargh/renderer/blocks/dates.rb', line 32 def day_of_month_suffix day_of_month.ordinalize end |
#short_year ⇒ Object
40 41 42 |
# File 'lib/tumblargh/renderer/blocks/dates.rb', line 40 def short_year year.to_s[2..4] end |
#time_ago ⇒ Object
44 45 46 47 |
# File 'lib/tumblargh/renderer/blocks/dates.rb', line 44 def time_ago # ActionView::Helpers::DateHelper::time_ago_in_words(date) "1 day ago" end |
#year ⇒ Object
36 37 38 |
# File 'lib/tumblargh/renderer/blocks/dates.rb', line 36 def year date.year end |