Class: Bookit::Content::Link

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

Overview

Content that will be clickable to web urls. Can be images or text.

Instance Attribute Summary collapse

Attributes inherited from Generic

#attributes

Instance Method Summary collapse

Methods inherited from Generic

#is_type?, #type

Constructor Details

#initialize(url, objects, options = {}) ⇒ Link

Returns a new instance of Link.



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

def initialize(url, objects, options={})
  @url = url
  objects.compact!
  @objects = (objects.class == Array) ? objects : [objects]

  super options
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/bookit/content/link.rb', line 6

def text
  @text
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/bookit/content/link.rb', line 6

def url
  @url
end

Instance Method Details

#renderObject



16
17
18
# File 'lib/bookit/content/link.rb', line 16

def render
  [@url, @objects.map(&:render)]
end