# File 'lib/bunto/readers/post_reader.rb', line 4definitialize(site)@site=siteend
Instance Attribute Details
#site ⇒ Object(readonly)
Returns the value of attribute site.
3
4
5
# File 'lib/bunto/readers/post_reader.rb', line 3defsite@siteend
#unfiltered_content ⇒ Object(readonly)
Returns the value of attribute unfiltered_content.
3
4
5
# File 'lib/bunto/readers/post_reader.rb', line 3defunfiltered_content@unfiltered_contentend
Instance Method Details
#read_content(dir, magic_dir, matcher) ⇒ Object
Read all the content files from //magic_dir
and return them with the type klass.
dir - The String relative path of the directory to read.
magic_dir - The String relative directory to
,
looks for content here.
klass - The return type of the content.
Returns klass type of content files
54
55
56
57
58
59
60
61
62
63
# File 'lib/bunto/readers/post_reader.rb', line 54defread_content(dir,magic_dir,matcher)@site.reader.get_entries(dir,magic_dir).mapdo|entry|nextunlessentry=~matcherpath=@site.in_source_dir(File.join(dir,magic_dir,entry))Document.new(path,{:site=>@site,:collection=>@site.posts,})end.reject(&:nil?)end
#read_drafts(dir) ⇒ Object
Read all the files in //_drafts and create a new
Document object with each one.
dir - The String relative path of the directory to read.
Returns nothing.
14
15
16
# File 'lib/bunto/readers/post_reader.rb', line 14defread_drafts(dir)read_publishable(dir,"_drafts",Document::DATELESS_FILENAME_MATCHER)end
#read_posts(dir) ⇒ Object
Read all the files in //_posts and create a new Document
object with each one.
dir - The String relative path of the directory to read.
Returns nothing.
24
25
26
# File 'lib/bunto/readers/post_reader.rb', line 24defread_posts(dir)read_publishable(dir,"_posts",Document::DATE_FILENAME_MATCHER)end
Read all the files in //<magic_dir> and create a new
Document object with each one insofar as it matches the regexp matcher.
dir - The String relative path of the directory to read.
Returns nothing.
34
35
36
37
38
39
40
41
42
43
# File 'lib/bunto/readers/post_reader.rb', line 34defread_publishable(dir,magic_dir,matcher)read_content(dir,magic_dir,matcher).tap{|docs|docs.each(&:read)}.selectdo|doc|site.publisher.publish?(doc).tapdo|will_publish|if!will_publish&&site.publisher.hidden_in_the_future?(doc)Bunto.logger.debug"Skipping:","#{doc.relative_path} has a future date"endendendend