Class: Zwite::Blog::Archive
Instance Attribute Summary collapse
-
#blog ⇒ Object
Properties.
-
#date ⇒ Object
Returns the value of attribute date.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Actions.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(blog, year, month) ⇒ Archive
constructor
Initialization.
- #to_liquid ⇒ Object
Constructor Details
#initialize(blog, year, month) ⇒ Archive
Initialization
37 38 39 40 41 |
# File 'lib/zwite/plugins/blog.rb', line 37 def initialize(blog, year, month) self.date = DateTime.new(year, month, 1, 0, 0, 0, DateTime.now.offset) self.blog = blog self.url = "#{self.blog.app.url}blog/#{self.date.strftime("%Y/%m")}/" end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
12 13 14 |
# File 'lib/zwite/plugins/blog.rb', line 12 def date @date end |
#url ⇒ Object
Returns the value of attribute url.
13 14 15 |
# File 'lib/zwite/plugins/blog.rb', line 13 def url @url end |
Instance Method Details
#<=>(other) ⇒ Object
Actions
47 48 49 50 51 52 |
# File 'lib/zwite/plugins/blog.rb', line 47 def <=>(other) if other.class == self.class return other.date <=> self.date end return nil end |
#eql?(other) ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/zwite/plugins/blog.rb', line 15 def eql?(other) if other.class == self.class return self.date == other.date end return false end |
#hash ⇒ Object
22 23 24 |
# File 'lib/zwite/plugins/blog.rb', line 22 def hash return self.to_liquid.hash end |
#to_liquid ⇒ Object
26 27 28 29 30 31 |
# File 'lib/zwite/plugins/blog.rb', line 26 def to_liquid return { "date" => self.date, "url" => self.url } end |