Class: Dimples::Category
- Inherits:
-
Object
- Object
- Dimples::Category
- Defined in:
- lib/dimples/category.rb
Overview
A class that models a single interview category.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#posts ⇒ Object
Returns the value of attribute posts.
-
#slug ⇒ Object
Returns the value of attribute slug.
Instance Method Summary collapse
-
#initialize(site, slug) ⇒ Category
constructor
A new instance of Category.
- #inspect ⇒ Object
Constructor Details
#initialize(site, slug) ⇒ Category
Returns a new instance of Category.
10 11 12 13 14 15 |
# File 'lib/dimples/category.rb', line 10 def initialize(site, slug) @site = site @slug = slug @name = @site.config['category_names'][slug] || slug.capitalize @posts = [] end |
Instance Attribute Details
#name ⇒ Object
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
Returns the value of attribute slug.
7 8 9 |
# File 'lib/dimples/category.rb', line 7 def slug @slug end |
Instance Method Details
#inspect ⇒ Object
17 18 19 |
# File 'lib/dimples/category.rb', line 17 def inspect "#<Dimples::Category @slug=#{@slug} @name=#{@name}>" end |