class PostRunner::View
Base class for all generated HTML pages.
Attributes
doc[R]
Public Class Methods
new(title, views, pages)
click to toggle source
Create a new View
object. @param title [String] The title of the HTML page @param views [ViewButtons] List of all cross referenced View
objects @param pages [PagingButtons] List of all pages of this View
# File lib/postrunner/View.rb, line 28 def initialize(title, views, pages) @doc = HTMLBuilder.new(title) @views = views @pages = pages @doc.unique(:view_style) { style } end
Public Instance Methods
body() { || ... }
click to toggle source
Create the body section of the HTML document.
# File lib/postrunner/View.rb, line 39 def body ViewTop.new(@views, @pages).to_html(@doc) yield if block_given? ViewBottom.new.to_html(@doc) self end
to_html()
click to toggle source
Convert the View
into an HTML document.
# File lib/postrunner/View.rb, line 48 def to_html @doc.to_html end
write(file_name)
click to toggle source
Write the HTML document to a file @param file_name [String] Name of the file to write
# File lib/postrunner/View.rb, line 54 def write(file_name) begin File.write(file_name, to_html) rescue IOError Log.fatal "Cannot write file '#{file_name}: #{$!}" end end
Private Instance Methods
style()
click to toggle source
# File lib/postrunner/View.rb, line 64 def style @doc.head { @doc.style(<<"EOT" body { font-family: verdana,arial,sans-serif; margin: 0px; } .flexitable { width: 100%; border: 2px solid #545454; border-collapse: collapse; font-size:11pt; } .ft_head_row { background-color: #DEDEDE } .ft_even_row { background-color: #FCFCFC } .ft_odd_row { background-color: #F1F1F1 } .ft_cell { border: 1px solid #CCCCCC; padding: 1px 3px; } EOT ) } end