Class: Dimples::Category
- Inherits:
-
Object
- Object
- Dimples::Category
- Defined in:
- lib/dimples/category.rb
Overview
A single post category for a site.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#posts ⇒ Object
Returns the value of attribute posts.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Instance Method Summary collapse
-
#initialize(site, slug) ⇒ Category
constructor
A new instance of Category.
Constructor Details
#initialize(site, slug) ⇒ Category
Returns a new instance of Category.
10 11 12 13 14 15 16 |
# File 'lib/dimples/category.rb', line 10 def initialize(site, slug) @site = site @slug = slug @name = @site.config.category_names[slug.to_sym] || slug.capitalize @posts = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/dimples/category.rb', line 6 def name @name end |
#posts ⇒ Object
Returns the value of attribute posts.
8 9 10 |
# File 'lib/dimples/category.rb', line 8 def posts @posts end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
7 8 9 |
# File 'lib/dimples/category.rb', line 7 def slug @slug end |