Class: Jekyll::PDF::Partial
- Inherits:
-
Object
- Object
- Jekyll::PDF::Partial
- Extended by:
- Forwardable
- Includes:
- Helper
- 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
-
#data ⇒ Object
Fetch YAML front-matter data from related doc, without layout key.
-
#dir ⇒ Object
Returns the cache directory.
- #id ⇒ Object
-
#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
Methods included from Helper
Constructor Details
#initialize(doc, partial) ⇒ Partial
Initialize this Partial instance.
doc - The Document.
Returns the new Partial.
25 26 27 28 29 |
# File 'lib/jekyll/pdf/partial.rb', line 25 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.
14 15 16 |
# File 'lib/jekyll/pdf/partial.rb', line 14 def content @content end |
#doc ⇒ Object
Returns the value of attribute doc.
11 12 13 |
# File 'lib/jekyll/pdf/partial.rb', line 11 def doc @doc end |
#ext ⇒ Object
Returns the value of attribute ext.
14 15 16 |
# File 'lib/jekyll/pdf/partial.rb', line 14 def ext @ext end |
#output ⇒ Object
72 73 74 |
# File 'lib/jekyll/pdf/partial.rb', line 72 def output @output ||= Renderer.new(doc.site, self, site.site_payload).run end |
#partial ⇒ Object
Returns the value of attribute partial.
12 13 14 |
# File 'lib/jekyll/pdf/partial.rb', line 12 def partial @partial end |
#write ⇒ Object
generate temp file & set output to it’s path
77 78 79 |
# File 'lib/jekyll/pdf/partial.rb', line 77 def write @write end |
Instance Method Details
#data ⇒ Object
Fetch YAML front-matter data from related doc, without layout key
Returns Hash of doc data
34 35 36 37 38 |
# File 'lib/jekyll/pdf/partial.rb', line 34 def data @data ||= doc.data.dup @data.delete("layout") @data end |
#dir ⇒ Object
Returns the cache directory
52 53 54 |
# File 'lib/jekyll/pdf/partial.rb', line 52 def dir @dir ||= cache_dir end |
#id ⇒ Object
47 48 49 |
# File 'lib/jekyll/pdf/partial.rb', line 47 def id 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.
68 69 70 |
# File 'lib/jekyll/pdf/partial.rb', line 68 def inspect "<Partial: #{self.id}>" end |
#path ⇒ Object
43 44 45 |
# File 'lib/jekyll/pdf/partial.rb', line 43 def path File.join(doc.path, partial) end |
#place_in_layout? ⇒ Boolean
91 92 93 |
# File 'lib/jekyll/pdf/partial.rb', line 91 def place_in_layout? false end |
#to_liquid ⇒ Object
60 61 62 63 64 65 |
# File 'lib/jekyll/pdf/partial.rb', line 60 def to_liquid doc.data[partial] = nil @to_liquid ||= doc.to_liquid doc.data[partial] = self @to_liquid end |
#to_s ⇒ Object
56 57 58 |
# File 'lib/jekyll/pdf/partial.rb', line 56 def to_s output || content end |
#trigger_hooks ⇒ Object
40 41 |
# File 'lib/jekyll/pdf/partial.rb', line 40 def trigger_hooks(*) end |