Class: Zwite::Blog::Archive

Inherits:
Object show all
Defined in:
lib/zwite/plugins/blog.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#blogObject

Properties



11
12
13
# File 'lib/zwite/plugins/blog.rb', line 11

def blog
  @blog
end

#dateObject

Returns the value of attribute date.



12
13
14
# File 'lib/zwite/plugins/blog.rb', line 12

def date
  @date
end

#urlObject

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

Returns:

  • (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

#hashObject



22
23
24
# File 'lib/zwite/plugins/blog.rb', line 22

def hash
  return self.to_liquid.hash
end

#to_liquidObject



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