Class: Clayoven::Page
- Inherits:
-
Object
- Object
- Clayoven::Page
- Defined in:
- lib/clayoven.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#indexfill ⇒ Object
Returns the value of attribute indexfill.
-
#paragraphs ⇒ Object
Returns the value of attribute paragraphs.
-
#permalink ⇒ Object
Returns the value of attribute permalink.
-
#target ⇒ Object
Returns the value of attribute target.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#title ⇒ Object
Returns the value of attribute title.
-
#topic ⇒ Object
Returns the value of attribute topic.
-
#topics ⇒ Object
Returns the value of attribute topics.
Instance Method Summary collapse
-
#render(topics) ⇒ Object
Writes out HTML pages.
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def body @body end |
#filename ⇒ Object
Returns the value of attribute filename.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def filename @filename end |
#indexfill ⇒ Object
Returns the value of attribute indexfill.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def indexfill @indexfill end |
#paragraphs ⇒ Object
Returns the value of attribute paragraphs.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def paragraphs @paragraphs end |
#permalink ⇒ Object
Returns the value of attribute permalink.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def permalink @permalink end |
#target ⇒ Object
Returns the value of attribute target.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def target @target end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def @timestamp end |
#title ⇒ Object
Returns the value of attribute title.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def title @title end |
#topic ⇒ Object
Returns the value of attribute topic.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def topic @topic end |
#topics ⇒ Object
Returns the value of attribute topics.
23 24 25 |
# File 'lib/clayoven.rb', line 23 def topics @topics end |
Instance Method Details
#render(topics) ⇒ Object
Writes out HTML pages. Takes a list of topics to render
Prints a “[GEN]” line for every file it writes out.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/clayoven.rb', line 29 def render(topics) @topics = topics @paragraphs = ClayText.process! @body Slim::Engine. pretty: true, sort_attrs: false rendered = Slim::Template.new { IO.read("design/template.slim") }.render(self) File.open(@target, mode="w") do |targetio| nbytes = targetio.write(rendered) puts "[GEN] #{@target} (#{nbytes} bytes out)" end end |