Class: Dimples::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/dimples/category.rb

Overview

A single post category for a site.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/dimples/category.rb', line 6

def name
  @name
end

#postsObject

Returns the value of attribute posts.



8
9
10
# File 'lib/dimples/category.rb', line 8

def posts
  @posts
end

#slugObject (readonly)

Returns the value of attribute slug.



7
8
9
# File 'lib/dimples/category.rb', line 7

def slug
  @slug
end