Class: Brandish::Processors::HTML::Output::Document Private
- Inherits:
-
Object
- Object
- Brandish::Processors::HTML::Output::Document
- Defined in:
- lib/brandish/processors/html/output/document.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A "document." This contains meta information for the document, such as the title, author, description, styles, and scripts that are used to set up the HTML document.
Instance Attribute Summary collapse
-
#author ⇒ ::String?
private
The author for the document.
-
#description ⇒ ::String?
private
The description of the document.
-
#title ⇒ ::String?
private
The title of the document.
Instance Method Summary collapse
-
#add_inline_script(content) ⇒ self
private
Adds an inline script.
-
#add_inline_style(content) ⇒ self
private
Adds an inline style.
-
#add_linked_script(content) ⇒ self
private
Adds an linked script.
-
#add_linked_style(content) ⇒ self
private
Adds an linked style.
-
#add_script(type, content) ⇒ self
private
Adds a given script with the given type.
-
#add_style(type, content) ⇒ self
private
Adds a given style with the given type.
-
#data ⇒ ::Object
private
The data from this document.
-
#initialize ⇒ Document
constructor
private
Initialize the document.
Constructor Details
#initialize ⇒ Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the document.
30 31 32 33 34 35 36 |
# File 'lib/brandish/processors/html/output/document.rb', line 30 def initialize @title = "" @author = "" @description = "" @styles = [] @scripts = [] end |
Instance Attribute Details
#author ⇒ ::String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The author for the document. This is used for a <meta>
tag.
22 23 24 |
# File 'lib/brandish/processors/html/output/document.rb', line 22 def @author end |
#description ⇒ ::String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The description of the document. This is used for a <meta>
tag.
27 28 29 |
# File 'lib/brandish/processors/html/output/document.rb', line 27 def description @description end |
#title ⇒ ::String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The title of the document. This is used for the <title>
tag.
17 18 19 |
# File 'lib/brandish/processors/html/output/document.rb', line 17 def title @title end |
Instance Method Details
#add_inline_script(content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds an inline script.
101 102 103 |
# File 'lib/brandish/processors/html/output/document.rb', line 101 def add_inline_script(content) add_script(:inline, content) end |
#add_inline_style(content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds an inline style.
83 84 85 |
# File 'lib/brandish/processors/html/output/document.rb', line 83 def add_inline_style(content) add_style(:inline, content) end |
#add_linked_script(content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds an linked script.
110 111 112 |
# File 'lib/brandish/processors/html/output/document.rb', line 110 def add_linked_script(content) add_script(:linked, URI.escape(content.to_s)) end |
#add_linked_style(content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds an linked style.
92 93 94 |
# File 'lib/brandish/processors/html/output/document.rb', line 92 def add_linked_style(content) add_style(:linked, URI.escape(content.to_s)) end |
#add_script(type, content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds a given script with the given type. The type of the kind of
script it is; this should be either one of :inline
or :linked
.
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/brandish/processors/html/output/document.rb', line 66 def add_script(type, content) inline = type == :inline linked = type == :linked @scripts << { "inline?" => inline, "linked?" => linked, "content" => content.to_s } self end |
#add_style(type, content) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds a given style with the given type. The type is the kind of
style it is; this should be either one of :inline
or :linked
.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/brandish/processors/html/output/document.rb', line 46 def add_style(type, content) inline = type == :inline linked = type == :linked @styles << { "inline?" => inline, "linked?" => linked, "content" => content.to_s } self end |
#data ⇒ ::Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The data from this document. This is used to pass all of the proper information to the templating library.
118 119 120 121 122 |
# File 'lib/brandish/processors/html/output/document.rb', line 118 def data { "title" => @title, "author" => @author, "description" => @description, "styles" => @styles, "scripts" => @scripts }.freeze end |