Class: Bookit::Content::Paragraph

Inherits:
Generic
  • Object
show all
Defined in:
lib/bookit/content/paragraph.rb

Instance Attribute Summary collapse

Attributes inherited from Generic

#attributes

Instance Method Summary collapse

Methods inherited from Generic

#is_type?, #type

Constructor Details

#initialize(contents, options = {}) ⇒ Paragraph

Paragraph can contain most other object types. Text, images or links.



7
8
9
10
11
12
13
# File 'lib/bookit/content/paragraph.rb', line 7

def initialize(contents, options={})
  # this could be an array of images, text, links or just a single element
  contents.compact!
  @contents = (contents.class == Array) ? contents : [contents]

  super options
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



4
5
6
# File 'lib/bookit/content/paragraph.rb', line 4

def contents
  @contents
end

Instance Method Details

#renderObject



15
16
17
# File 'lib/bookit/content/paragraph.rb', line 15

def render 
  @contents
end