Class: Plist4r::Backend::Test::Output

Defined in:
lib/plist4r/backend/test/output.rb

Instance Methods

Constructor Details

- (Output) initialize(*args, &blk)

A new instance of Output



32
33
34
35
# File 'lib/plist4r/backend/test/output.rb', line 32

def initialize *args, &blk
  @test_harness = Plist4r::Backend::Test::Harness.new
  @test_harness.run_tests
end

Instance Method Details

- (Object) haml



9
10
11
# File 'lib/plist4r/backend/test/output.rb', line 9

def haml
  @haml ||= "%h1 Backends\n%div\n%p Documentation for the Plist4r backend modules - please see <tt><a href=\"Plist4r/Backend.html\" target=\"_self\" title=\"Plist4r::Backend (class)\">Plist4r::Backend</a></tt>\n%h3 Performance\n%p Time elapsed for encoding / decoding a non-flat (nested) plist structure of 1024 keys\n%p Real elapsed time based on - 2GHz Intel Core Duo with 2GB Ram\n%p Ruby Enterprise Edition (REE) 1.8.7 p248, Mac OS-X 10.6.3\n= @test_harness.results\n%p To re-run the backend tests\n%pre{ :class => \"code\" } $ cd plist4r && rake backends:test\n%p\n"
end

- (Object) results_stdout



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/plist4r/backend/test/output.rb', line 44

def results_stdout
  puts ""
  puts "REFERENCE BACKENDS"
  puts "=================="
  Plist4r::Backend::Test::Harness::ReferenceBackends.each do |sym,b_sym|
    puts "#{sym.inspect} generated by #{b_sym.inspect}"
  end
  puts ""
  puts @test_harness.results.inspect
  puts ""
end

- (Object) to_s



26
27
28
29
30
# File 'lib/plist4r/backend/test/output.rb', line 26

def to_s
  require 'haml'
  engine = ::Haml::Engine.new self.haml
  rendered_html_output = engine.render self
end

- (Object) write_html_file



37
38
39
40
41
42
# File 'lib/plist4r/backend/test/output.rb', line 37

def write_html_file
  docs_dir = File.dirname(__FILE__) + "/../../../../lib/plist4r/docs"
  File.open "#{docs_dir}/Backends.html","w" do |o|
    o << to_s
  end
end