Class: Post
- Inherits:
-
Zarchitect
- Object
- Zarchitect
- Post
- Defined in:
- lib/zarchitect/post.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
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#conf ⇒ Object
readonly
Returns the value of attribute conf.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#draft ⇒ Object
readonly
Returns the value of attribute draft.
-
#html_path ⇒ Object
readonly
Returns the value of attribute html_path.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#write_block ⇒ Object
Returns the value of attribute write_block.
Instance Method Summary collapse
- #build_html ⇒ Object
-
#initialize(path, section) ⇒ Post
constructor
A new instance of Post.
- #rss? ⇒ Boolean
- #tags ⇒ Object
- #write_html ⇒ Object
Methods inherited from Zarchitect
Constructor Details
#initialize(path, section) ⇒ Post
Returns a new instance of Post.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zarchitect/post.rb', line 6 def initialize(path, section) GPI.print "Initializing post #{path}.", GPI::CLU.check_option('v') @section = section @source_path = path @conf = Config.new(path) @conf.validate_post @conf.setup @id = @conf.id.clone if @conf.has_option?("id") if @conf.has_option?("key") @key = @conf.key.clone else @key = @id.clone end if @conf.has_option?("always_write") @always_write = @conf.always_write.clone else @always_write = false end @category = nil @write_block = false set_draft set_rss set_date fetch_category if @conf.has_option?("category") create_dir set_url set_html_path fetch_content set_description set_name setup_html rss.try_item(self) end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def category @category end |
#conf ⇒ Object (readonly)
Returns the value of attribute conf.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def conf @conf end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def content @content end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def date @date end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def description @description end |
#draft ⇒ Object (readonly)
Returns the value of attribute draft.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def draft @draft end |
#html_path ⇒ Object (readonly)
Returns the value of attribute html_path.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def html_path @html_path end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def name @name end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def source_path @source_path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/zarchitect/post.rb', line 2 def url @url end |
#write_block ⇒ Object
Returns the value of attribute write_block.
4 5 6 |
# File 'lib/zarchitect/post.rb', line 4 def write_block @write_block end |
Instance Method Details
#build_html ⇒ Object
48 49 50 51 |
# File 'lib/zarchitect/post.rb', line 48 def build_html GPI.print "Composing HTML for #{@source_path}.", GPI::CLU.check_option('v') @html.compose end |
#rss? ⇒ Boolean
64 65 66 |
# File 'lib/zarchitect/post.rb', line 64 def rss? return @rss end |
#tags ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/zarchitect/post.rb', line 40 def if @conf.has_option?("tags") @conf. else Array.new end end |
#write_html ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/zarchitect/post.rb', line 53 def write_html if @write_block && !@always_write GPI.print "Skipping HTML write from #{@source_path}.", GPI::CLU.check_option('v') else GPI.print "Writing HTML from #{@source_path}.", GPI::CLU.check_option('v') @html.write end end |