Class: HTML
Constant Summary
Constants inherited
from Zarchitect
Zarchitect::ASSETDIR, Zarchitect::ASSETSDIR, Zarchitect::BUILDIR, Zarchitect::CONFIGDIR, Zarchitect::DEBUGSDIR, Zarchitect::DRAFTDIR, Zarchitect::FILEDIR, Zarchitect::FILESDIR, Zarchitect::HTMLDIR, Zarchitect::LAYOUTDIR, Zarchitect::NODEDIR, Zarchitect::SHARESDIR, Zarchitect::VERSION
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Zarchitect
#main, #rss
Constructor Details
#initialize(str) ⇒ HTML
Returns a new instance of HTML.
4
5
6
7
8
|
# File 'lib/zarchitect/html.rb', line 4
def initialize(str)
@data = Hash.new
@meta = Hash.new
@path = str
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2
3
4
|
# File 'lib/zarchitect/html.rb', line 2
def data
@data
end
|
Returns the value of attribute meta.
2
3
4
|
# File 'lib/zarchitect/html.rb', line 2
def meta
@meta
end
|
#path ⇒ Object
Returns the value of attribute path.
2
3
4
|
# File 'lib/zarchitect/html.rb', line 2
def path
@path
end
|
Instance Method Details
#compose ⇒ Object
23
24
25
26
27
28
|
# File 'lib/zarchitect/html.rb', line 23
def compose
set_view
@data["view"] = @view.output
@data["meta"] = @meta
set_layout
end
|
#output ⇒ Object
35
36
37
|
# File 'lib/zarchitect/html.rb', line 35
def output
@layout.output
end
|
#set_data(key, value) ⇒ Object
10
11
12
|
# File 'lib/zarchitect/html.rb', line 10
def set_data(key, value)
@data[key] = value
end
|
14
15
16
|
# File 'lib/zarchitect/html.rb', line 14
def set_meta(key, value)
@meta[key] = value
end
|
#set_templates(layout, view) ⇒ Object
18
19
20
21
|
# File 'lib/zarchitect/html.rb', line 18
def set_templates(layout, view)
@layout_path = layout
@view_path = view
end
|
#write ⇒ Object
30
31
32
33
|
# File 'lib/zarchitect/html.rb', line 30
def write
GPI.print "Writing HTML to #{@path}.", GPI::CLU.check_option('v')
File.open(@path, "w") { |f| f.write(@layout.output) }
end
|