Class: OakTree::Template::PostArchive
- Defined in:
- lib/oaktree/template/post_archive.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#month ⇒ Object
Returns the value of attribute month.
-
#next_archive ⇒ Object
the next most recent archive.
-
#posts ⇒ Object
Returns the value of attribute posts.
-
#previous_archive ⇒ Object
the next oldest archive.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #date ⇒ Object
- #datetime ⇒ Object
-
#initialize(year = 1, month = 1, posts = [], spec, blog) {|_self| ... } ⇒ PostArchive
constructor
A new instance of PostArchive.
- #open? ⇒ Boolean
- #permalink ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(year = 1, month = 1, posts = [], spec, blog) {|_self| ... } ⇒ PostArchive
Returns a new instance of PostArchive.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/oaktree/template/post_archive.rb', line 20 def initialize year=1, month=1, posts=[], spec, blog @year = year @month = month @posts = posts @spec = spec @blog = blog @datetime = DateTime.new(year, month, 1) formatted_date = @datetime.strftime(@spec.date_path_format) @permalink = "#{@spec.base_url}#{@spec.post_path}#{formatted_date}" yield self if block_given? end |
Instance Attribute Details
#month ⇒ Object
Returns the value of attribute month.
13 14 15 |
# File 'lib/oaktree/template/post_archive.rb', line 13 def month @month end |
#next_archive ⇒ Object
the next most recent archive
16 17 18 |
# File 'lib/oaktree/template/post_archive.rb', line 16 def next_archive @next_archive end |
#posts ⇒ Object
Returns the value of attribute posts.
14 15 16 |
# File 'lib/oaktree/template/post_archive.rb', line 14 def posts @posts end |
#previous_archive ⇒ Object
the next oldest archive
18 19 20 |
# File 'lib/oaktree/template/post_archive.rb', line 18 def previous_archive @previous_archive end |
#year ⇒ Object
Returns the value of attribute year.
12 13 14 |
# File 'lib/oaktree/template/post_archive.rb', line 12 def year @year end |
Instance Method Details
#date ⇒ Object
33 34 35 |
# File 'lib/oaktree/template/post_archive.rb', line 33 def date proc_for_datetime(@datetime) end |
#datetime ⇒ Object
37 38 39 |
# File 'lib/oaktree/template/post_archive.rb', line 37 def datetime @datetime end |
#open? ⇒ Boolean
45 46 47 |
# File 'lib/oaktree/template/post_archive.rb', line 45 def open? self == @blog.archive end |
#permalink ⇒ Object
41 42 43 |
# File 'lib/oaktree/template/post_archive.rb', line 41 def permalink @permalink end |