Class: Tumblargh::Renderer::Document

Inherits:
Base
  • Object
show all
Defined in:
lib/tumblargh/renderer/document.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #node, #options

Instance Method Summary collapse

Methods inherited from Base

#context_post, contextual_tag, #escape_html, #escape_url, #initialize, #method_missing, #strip_html

Constructor Details

This class inherits a constructor from Tumblargh::Renderer::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Tumblargh::Renderer::Base

Instance Method Details

#boolean(key) ⇒ Object



46
47
48
# File 'lib/tumblargh/renderer/document.rb', line 46

def boolean(key)
  custom_value_for_type :if, key
end

#color(key) ⇒ Object



30
31
32
# File 'lib/tumblargh/renderer/document.rb', line 30

def color(key)
  custom_value_for_type :color, key
end

#custom_value_for_type(type, key) ⇒ Object



50
51
52
# File 'lib/tumblargh/renderer/document.rb', line 50

def custom_value_for_type(type, key)
  config[type][key] rescue raise "No appearance option for #{type}:#{key}"
end

#faviconObject



19
20
21
22
# File 'lib/tumblargh/renderer/document.rb', line 19

def favicon
  # TODO
  ''
end

#font(key) ⇒ Object



34
35
36
# File 'lib/tumblargh/renderer/document.rb', line 34

def font(key)
  custom_value_for_type :font, key
end

#image(key) ⇒ Object



38
39
40
# File 'lib/tumblargh/renderer/document.rb', line 38

def image(key)
  custom_value_for_type :image, key
end

#meta_descriptionObject



14
15
16
17
# File 'lib/tumblargh/renderer/document.rb', line 14

def meta_description
  strip_html(description)
  strip_html(description)
end

#permalink?Boolean

Are we rendering a permalink page?

Returns:

  • (Boolean)


6
7
8
# File 'lib/tumblargh/renderer/document.rb', line 6

def permalink?
  options[:permalink] == true
end

#renderObject

END TAGS ——



56
57
58
59
60
61
# File 'lib/tumblargh/renderer/document.rb', line 56

def render
  node.map do |n|
    renderer = Renderer.factory(n, self)
    renderer.render unless renderer.nil?
  end.flatten.join('')
end

#rssObject



24
25
26
# File 'lib/tumblargh/renderer/document.rb', line 24

def rss
  "#{context.url}rss"
end

#text(key) ⇒ Object



42
43
44
# File 'lib/tumblargh/renderer/document.rb', line 42

def text(key)
  custom_value_for_type :text, key
end