Class: Jekyll::PDF::Partial
- Inherits:
-
Object
- Object
- Jekyll::PDF::Partial
- Extended by:
- Forwardable
- Defined in:
- lib/jekyll/pdf/partial.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#ext ⇒ Object
Returns the value of attribute ext.
- #output ⇒ Object
-
#partial ⇒ Object
Returns the value of attribute partial.
-
#write ⇒ Object
generate temp file & set output to it’s path.
Instance Method Summary collapse
-
#clean ⇒ Object
delete temp file.
-
#data ⇒ Object
Fetch YAML front-matter data from related doc, without layout key.
-
#dir ⇒ Object
Returns the cache directory.
-
#filename ⇒ Object
Returns the file name for the temporary file.
-
#initialize(doc, partial) ⇒ Partial
constructor
Initialize this Partial instance.
-
#inspect ⇒ Object
Returns the shorthand String identifier of this doc.
- #path ⇒ Object
- #place_in_layout? ⇒ Boolean
- #to_liquid ⇒ Object
- #to_s ⇒ Object
- #trigger_hooks ⇒ Object
Constructor Details
#initialize(doc, partial) ⇒ Partial
Initialize this Partial instance.
doc - The Document.
Returns the new Partial.
23 24 25 26 27 |
# File 'lib/jekyll/pdf/partial.rb', line 23 def initialize(doc, partial) self.doc = doc self.partial = partial self.content = build_partial(partial) end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
12 13 14 |
# File 'lib/jekyll/pdf/partial.rb', line 12 def content @content end |
#doc ⇒ Object
Returns the value of attribute doc.
9 10 11 |
# File 'lib/jekyll/pdf/partial.rb', line 9 def doc @doc end |
#ext ⇒ Object
Returns the value of attribute ext.
12 13 14 |
# File 'lib/jekyll/pdf/partial.rb', line 12 def ext @ext end |
#output ⇒ Object
71 72 73 |
# File 'lib/jekyll/pdf/partial.rb', line 71 def output @output ||= Renderer.new(doc.site, self, site.site_payload).run end |
#partial ⇒ Object
Returns the value of attribute partial.
10 11 12 |
# File 'lib/jekyll/pdf/partial.rb', line 10 def partial @partial end |
#write ⇒ Object
generate temp file & set output to it’s path
76 77 78 |
# File 'lib/jekyll/pdf/partial.rb', line 76 def write @write end |
Instance Method Details
#clean ⇒ Object
delete temp file
88 89 90 |
# File 'lib/jekyll/pdf/partial.rb', line 88 def clean File.delete(@output) end |
#data ⇒ Object
Fetch YAML front-matter data from related doc, without layout key
Returns Hash of doc data
32 33 34 35 36 |
# File 'lib/jekyll/pdf/partial.rb', line 32 def data @data ||= doc.data.dup @data.delete("layout") @data end |
#dir ⇒ Object
Returns the cache directory
51 52 53 |
# File 'lib/jekyll/pdf/partial.rb', line 51 def dir @dir ||= cache_dir end |
#filename ⇒ Object
Returns the file name for the temporary file
46 47 48 |
# File 'lib/jekyll/pdf/partial.rb', line 46 def filename File.basename(path, File.extname(path)) + "-" + Digest::MD5.hexdigest(to_s) + File.extname(path) end |
#inspect ⇒ Object
Returns the shorthand String identifier of this doc.
67 68 69 |
# File 'lib/jekyll/pdf/partial.rb', line 67 def inspect "<Partial: #{self.id}>" end |
#path ⇒ Object
41 42 43 |
# File 'lib/jekyll/pdf/partial.rb', line 41 def path File.join(doc.path, partial) end |
#place_in_layout? ⇒ Boolean
92 93 94 |
# File 'lib/jekyll/pdf/partial.rb', line 92 def place_in_layout? false end |
#to_liquid ⇒ Object
59 60 61 62 63 64 |
# File 'lib/jekyll/pdf/partial.rb', line 59 def to_liquid doc.data[partial] = nil @to_liquid ||= doc.to_liquid doc.data[partial] = self @to_liquid end |
#to_s ⇒ Object
55 56 57 |
# File 'lib/jekyll/pdf/partial.rb', line 55 def to_s output || content end |
#trigger_hooks ⇒ Object
38 39 |
# File 'lib/jekyll/pdf/partial.rb', line 38 def trigger_hooks(*) end |