Class Nukumi2::Blog
In: lib/nukumi2.rb
Parent: Object

Methods

Classes and Modules

Class Nukumi2::Blog::NotFound

Attributes

categories  [R] 
hidden  [R] 

Public Class methods

[Source]

    # File lib/nukumi2.rb, line 63
63:   def initialize
64:   end

Public Instance methods

[Source]

     # File lib/nukumi2.rb, line 109
109:   def fetch(path)
110:     flavor = default_flavor
111: 
112:     path.gsub!(/\/index\b/, '/')
113:     path = path.gsub(/\.(.*?)$/) { flavor = $1; '' }
114: 
115:     find_view(path).new(registry, path).to_page(flavor)
116:   end

[Source]

     # File lib/nukumi2.rb, line 118
118:   def find_view(path)
119:     path = path + "/"  if path[-1] != ?/
120: 
121:     best_topic = topictree.find_most_specific path, @publishable.keys
122: 
123:     raise NotFound  unless best_topic
124:     @publishable[best_topic]
125:   end

[Source]

    # File lib/nukumi2.rb, line 74
74:   def get_categories
75:     @publishable = {}
76:     @hidden = []
77: 
78:     config.get_topics.each { |topic, options|
79:       if options.title && topic !~ /\*/
80:         topictree.create(topic, options.title, options.description)
81:       end
82: 
83:       if options.view
84:         @publishable[topic] = View.const_get(options.view)
85:       end
86: 
87:       @hidden << topic  if options.hidden == true
88:     }
89:   end

[Source]

    # File lib/nukumi2.rb, line 70
70:   def get_config
71:     @categories = config.get_topics
72:   end

[Source]

    # File lib/nukumi2.rb, line 66
66:   def get_entries
67:     @entries = all_backends.map { |b| b.get }.flatten.uniq
68:   end

[Source]

     # File lib/nukumi2.rb, line 103
103:   def insert_entries
104:     @entries.each { |entry|
105:       entry.insert_into_topictree topictree
106:     }
107:   end

[Source]

    # File lib/nukumi2.rb, line 91
91:   def load!
92:     get_config
93:     get_categories
94:     get_entries
95:     insert_entries
96:   end

[Source]

     # File lib/nukumi2.rb, line 98
 98:   def reload!
 99:     topictree.clear!
100:     load!
101:   end

[Validate]