Parent

Class Index [+]

Quicksearch

Postage::Finder

This class is a utility for find all posts in specific directory.

Attributes

posts[R]

Post list

tags[R]

Post tags list

Public Class Methods

new(directory) click to toggle source

Finder most be initialized with the directory that contains post files.

    # File lib/postage/finder.rb, line 14
14:     def initialize(directory)
15:       @files = Dir[File.join(directory, "**.*")]
16:     end

Public Instance Methods

all_post_tags() click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 43
43:     def all_post_tags
44:       all_posts
45:       @tags ||= @posts.collect{ |post| post.tags }.flatten.uniq.sort
46:     end
all_posts() click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 24
24:     def all_posts
25:       @posts ||= load_all_post_files
26:     end
all_posts_by_tag(tag) click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 28
28:     def all_posts_by_tag(tag)
29:       all_posts
30:       @posts.find_all{ |post| post.tags.include?(tag) }
31:     end
all_tags() click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 48
48:     def all_tags
49:       all_post_tags
50:     end
load_all_post_files() click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 18
18:     def load_all_post_files
19:       @files.sort.collect do |file_name|
20:         Post.load(file_name)
21:       end
22:     end
post(year, month, day, name) click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 33
33:     def post(year, month, day, name)
34:       all_posts
35:       @posts.find{ |post| post.file.match(%r{#{year}#{month}#{day}-#{name}*.*}i) }
36:     end
posts(keywords) click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 38
38:     def posts(keywords)
39:       all_posts
40:       @posts.find_all{ |post| post.matched? search_expresion(keywords) }
41:     end
tag(name) click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 52
52:     def tag(name)
53:       all_tags
54:       @tags.find{ |tag| tag == name }
55:     end

Private Instance Methods

search_expresion(keywords) click to toggle source

(Not documented)

    # File lib/postage/finder.rb, line 59
59:     def search_expresion(keywords)
60:       %r{#{keywords.to_s.split(/[ ,\*]/).join('|')}}i
61:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.