Class: Zwite::Blog::Topic

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(blog, name) ⇒ Topic

Initialization



90
91
92
93
94
95
# File 'lib/zwite/plugins/blog.rb', line 90

def initialize(blog, name)
  self.blog = blog
  self.name = name
  self.slug = name.slugify
  self.url = "#{self.blog.app.url}blog/topics/#{self.slug}/"
end

Instance Attribute Details

#blogObject

Properties



62
63
64
# File 'lib/zwite/plugins/blog.rb', line 62

def blog
  @blog
end

#nameObject

Returns the value of attribute name.



63
64
65
# File 'lib/zwite/plugins/blog.rb', line 63

def name
  @name
end

#slugObject

Returns the value of attribute slug.



64
65
66
# File 'lib/zwite/plugins/blog.rb', line 64

def slug
  @slug
end

#urlObject

Returns the value of attribute url.



65
66
67
# File 'lib/zwite/plugins/blog.rb', line 65

def url
  @url
end

Instance Method Details

#<=>(other) ⇒ Object

Actions



101
102
103
104
105
106
# File 'lib/zwite/plugins/blog.rb', line 101

def <=>(other)
  if other.class == self.class
    return other.name <=> self.name
  end
  return nil
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
70
71
72
# File 'lib/zwite/plugins/blog.rb', line 67

def eql?(other)
  if other.class == self.class
    return self.name == other.name
  end
  return false
end

#hashObject



74
75
76
# File 'lib/zwite/plugins/blog.rb', line 74

def hash
  return self.to_liquid.hash
end

#to_liquidObject



78
79
80
81
82
83
84
# File 'lib/zwite/plugins/blog.rb', line 78

def to_liquid
  return {
    "name" => self.name,
    "slug" => self.slug,
    "url" => self.url,
  }
end