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

Inherits:
Object
  • Object
show all
Defined in:
lib/plist4r/backend/test/output.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args, &blk) ⇒ Output

Returns a new instance of Output.



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

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

Instance Method Details

#hamlObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

#results_stdoutObject



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

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

#to_sObject



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

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

#write_html_fileObject



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

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