Class: Repubmark::Elems::Iframe

Inherits:
Base
  • Object
show all
Defined in:
lib/repubmark/elems/iframe.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#parent

Instance Method Summary collapse

Methods inherited from Base

#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url, #to_summary_plain, #word_count

Constructor Details

#initialize(parent, title, src, url = nil) ⇒ Iframe

Returns a new instance of Iframe.



10
11
12
13
14
15
16
# File 'lib/repubmark/elems/iframe.rb', line 10

def initialize(parent, title, src, url = nil)
  super parent

  self.title = title
  self.src = src
  self.url = url || src
end

Instance Attribute Details

#srcObject

Returns the value of attribute src.



8
9
10
# File 'lib/repubmark/elems/iframe.rb', line 8

def src
  @src
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/repubmark/elems/iframe.rb', line 8

def title
  @title
end

#urlObject

Returns the value of attribute url.



8
9
10
# File 'lib/repubmark/elems/iframe.rb', line 8

def url
  @url
end

Instance Method Details

#to_gemtextObject



36
# File 'lib/repubmark/elems/iframe.rb', line 36

def to_gemtext = "=> #{url} #{title}\n"

#to_htmlObject

Basic methods #



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/repubmark/elems/iframe.rb', line 22

def to_html
  [
    "<div#{html_class(:iframe_wrap)}>\n",
    "<iframe\n",
    %(title="#{title}"\n),
    %(src="#{src}"\n),
    %(allowfullscreen=""\n),
    %(frameborder="0"\n),
    %(sandbox="allow-same-origin allow-scripts allow-popups"\n),
    "></iframe>\n",
    "</div>\n",
  ].join.freeze
end