Class: Statikaj::Render
Instance Attribute Summary collapse
-
#articles ⇒ Object
Returns the value of attribute articles.
-
#category ⇒ Object
Returns the value of attribute category.
-
#description ⇒ Object
Returns the value of attribute description.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #article {|_self| ... } ⇒ Object
-
#initialize(source, options) ⇒ Render
constructor
A new instance of Render.
- #page {|_self| ... } ⇒ Object
Constructor Details
#initialize(source, options) ⇒ Render
Returns a new instance of Render.
8 9 10 11 12 13 14 15 16 |
# File 'lib/statikaj/render.rb', line 8 def initialize(source, ) @source = source @article = .delete(:article) if [:article] @articles = .delete(:articles) if [:articles] @type = .fetch(:type, :html) if [:page] && @type == :html render_page(.delete(:page)) end end |
Instance Attribute Details
#articles ⇒ Object
Returns the value of attribute articles.
6 7 8 |
# File 'lib/statikaj/render.rb', line 6 def articles @articles end |
#category ⇒ Object
Returns the value of attribute category.
6 7 8 |
# File 'lib/statikaj/render.rb', line 6 def category @category end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/statikaj/render.rb', line 6 def description @description end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/statikaj/render.rb', line 6 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/statikaj/render.rb', line 6 def url @url end |
Instance Method Details
#article {|_self| ... } ⇒ Object
18 19 20 21 22 23 |
# File 'lib/statikaj/render.rb', line 18 def article(&blk) yield self to_html do @article.render(@source) end end |
#page {|_self| ... } ⇒ Object
25 26 27 28 |
# File 'lib/statikaj/render.rb', line 25 def page(&blk) yield self send("to_#{@type}"){ @page } end |