Class: Tag

Inherits:
Zarchitect show all
Defined in:
lib/zarchitect/tag.rb

Constant Summary

Constants inherited from Zarchitect

Zarchitect::ASSETDIR, Zarchitect::ASSETSDIR, Zarchitect::BUILDIR, Zarchitect::CONFIGDIR, Zarchitect::DEBUGSDIR, Zarchitect::DRAFTDIR, Zarchitect::FILEDIR, Zarchitect::FILESDIR, Zarchitect::HTMLDIR, Zarchitect::LAYOUTDIR, Zarchitect::NODEDIR, Zarchitect::SHARESDIR, Zarchitect::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Zarchitect

#main, #rss

Constructor Details

#initialize(str, cat) ⇒ Tag

Returns a new instance of Tag.



4
5
6
7
8
9
10
11
# File 'lib/zarchitect/tag.rb', line 4

def initialize(str, cat)
  @category = cat
  @name = str
  set_key
  @url = "/#{@category.section.key}/#{@category.key}/#{@key}/index.html"
  create_dir
  setup_index
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



2
3
4
# File 'lib/zarchitect/tag.rb', line 2

def category
  @category
end

#indexObject

Returns the value of attribute index.



2
3
4
# File 'lib/zarchitect/tag.rb', line 2

def index
  @index
end

#keyObject

Returns the value of attribute key.



2
3
4
# File 'lib/zarchitect/tag.rb', line 2

def key
  @key
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/zarchitect/tag.rb', line 2

def name
  @name
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/zarchitect/tag.rb', line 2

def url
  @url
end

Instance Method Details

#build_htmlObject



19
20
21
# File 'lib/zarchitect/tag.rb', line 19

def build_html
  @index.build_html
end

#postsObject



13
14
15
16
17
# File 'lib/zarchitect/tag.rb', line 13

def posts
  @category.section.posts.select do |p|
    ((p.category == @category) && (p.tags.include?(@name)))
  end
end

#write_htmlObject



23
24
25
# File 'lib/zarchitect/tag.rb', line 23

def write_html
  @index.write_html
end