Class: HTML

Inherits:
Zarchitect show all
Defined in:
lib/zarchitect/html.rb

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

#dataObject (readonly)

Returns the value of attribute data.



2
3
4
# File 'lib/zarchitect/html.rb', line 2

def data
  @data
end

#metaObject (readonly)

Returns the value of attribute meta.



2
3
4
# File 'lib/zarchitect/html.rb', line 2

def meta
  @meta
end

#pathObject (readonly)

Returns the value of attribute path.



2
3
4
# File 'lib/zarchitect/html.rb', line 2

def path
  @path
end

Instance Method Details

#composeObject



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

#outputObject



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

#set_meta(key, value) ⇒ Object



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

#writeObject



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