Class: Category
- Inherits:
-
Zarchitect
- Object
- Zarchitect
- Category
- Defined in:
- lib/zarchitect/category.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
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#section ⇒ Object
readonly
Returns the value of attribute section.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #build_html ⇒ Object
- #fetch_tags ⇒ Object
-
#initialize(key, name, section) ⇒ Category
constructor
A new instance of Category.
- #posts ⇒ Object
- #setup_index ⇒ Object
- #write_html ⇒ Object
Methods inherited from Zarchitect
Constructor Details
#initialize(key, name, section) ⇒ Category
Returns a new instance of Category.
4 5 6 7 8 9 10 11 |
# File 'lib/zarchitect/category.rb', line 4 def initialize(key, name, section) @key = key @name = name @section = section @url = "/#{@section.key}/#{@key}/index.html" create_dir end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def index @index end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def name @name end |
#section ⇒ Object (readonly)
Returns the value of attribute section.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def section @section end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/zarchitect/category.rb', line 2 def url @url end |
Instance Method Details
#build_html ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/zarchitect/category.rb', line 13 def build_html if .each do |t| t.build_html end end @index.build_html end |
#fetch_tags ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/zarchitect/category.rb', line 31 def # after fetch_pages is implemented ar = Array.new posts.each do |p| if p.conf.has_option?("tags") p.conf..each { |t| ar.push t } end end ar.sort!.uniq! if ar.count == 0 = nil else = Array.new ar.each { |v| .push Tag.new(v, self) } end end |
#posts ⇒ Object
48 49 50 |
# File 'lib/zarchitect/category.rb', line 48 def posts @section.posts.select { |p| p.category == self } end |
#setup_index ⇒ Object
52 53 54 |
# File 'lib/zarchitect/category.rb', line 52 def setup_index @index = Index.new(self) end |
#write_html ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/zarchitect/category.rb', line 22 def write_html if .each do |t| t.write_html end end @index.write_html end |