Class: Cloudpress::Renderers::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudpress/renderers/post.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, post, options = {}) ⇒ Post

Returns a new instance of Post.



8
9
10
11
12
# File 'lib/cloudpress/renderers/post.rb', line 8

def initialize(context, post, options={})
  @context = context
  @post    = post
  @options = options.reverse_merge default_options
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



6
7
8
# File 'lib/cloudpress/renderers/post.rb', line 6

def content
  @content
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/cloudpress/renderers/post.rb', line 5

def options
  @options
end

#postObject (readonly)

Returns the value of attribute post.



5
6
7
# File 'lib/cloudpress/renderers/post.rb', line 5

def post
  @post
end

Instance Method Details

#render(&block) ⇒ Object



14
15
16
17
18
# File 'lib/cloudpress/renderers/post.rb', line 14

def render(&block)
  @context.render layout: template, locals: {renderer: self} do
    content
  end.html_safe
end

#tags?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/cloudpress/renderers/post.rb', line 20

def tags?
  options[:tags]
end