Class: Statikaj::Render

Inherits:
Object show all
Defined in:
lib/statikaj/render.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, options) ⇒ Render

Returns a new instance of Render.



5
6
7
8
9
10
11
12
# File 'lib/statikaj/render.rb', line 5

def initialize(source, options)
  @source = source
  @article = options.delete(:article) if options[:article]
  @articles = options.delete(:articles) if options[:articles]
  if options[:page]
    render_page(options.delete(:page))
  end
end

Instance Attribute Details

#articlesObject

Returns the value of attribute articles.



3
4
5
# File 'lib/statikaj/render.rb', line 3

def articles
  @articles
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/statikaj/render.rb', line 3

def description
  @description
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/statikaj/render.rb', line 3

def title
  @title
end

Instance Method Details

#article {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



14
15
16
17
18
19
# File 'lib/statikaj/render.rb', line 14

def article(&blk)
  yield self
  to_html do
    @article.render(@source)
  end
end

#page {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



21
22
23
24
25
26
# File 'lib/statikaj/render.rb', line 21

def page(&blk)
  yield self
  to_html do
    @page
  end
end