Class: Zwite::Blog::Topic
Instance Attribute Summary collapse
-
#blog ⇒ Object
Properties.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Actions.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(blog, name) ⇒ Topic
constructor
Initialization.
- #to_liquid ⇒ Object
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
#name ⇒ Object
Returns the value of attribute name.
63 64 65 |
# File 'lib/zwite/plugins/blog.rb', line 63 def name @name end |
#slug ⇒ Object
Returns the value of attribute slug.
64 65 66 |
# File 'lib/zwite/plugins/blog.rb', line 64 def slug @slug end |
#url ⇒ Object
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
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 |
#hash ⇒ Object
74 75 76 |
# File 'lib/zwite/plugins/blog.rb', line 74 def hash return self.to_liquid.hash end |
#to_liquid ⇒ Object
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 |