Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

created gem basecamp-rb

  • Loading branch information...
commit 5a49f3daca50d433a8cd7a568d0393fd01606f20 1 parent 09fc9fa
Alexey Panin authored
Showing with 32,975 additions and 0 deletions.
  1. +4 −0 History.txt
  2. +26 −0 Manifest.txt
  3. 0  README
  4. +89 −0 README.rdoc
  5. +20 −0 Rakefile
  6. +59 −0 basecamp-rb.gemspec
  7. +743 −0 coverage/-usr-lib-ruby-1_8-base64_rb.html
  8. +1,179 −0 coverage/-usr-lib-ruby-1_8-benchmark_rb.html
  9. +2,373 −0 coverage/-usr-lib-ruby-1_8-drb-drb_rb.html
  10. +626 −0 coverage/-usr-lib-ruby-1_8-drb-eq_rb.html
  11. +646 −0 coverage/-usr-lib-ruby-1_8-drb-invokemethod_rb.html
  12. +612 −0 coverage/-usr-lib-ruby-1_8-drb_rb.html
  13. +977 −0 coverage/-usr-lib-ruby-1_8-kconv_rb.html
  14. +1,313 −0 coverage/-usr-lib-ruby-1_8-logger_rb.html
  15. +962 −0 coverage/-usr-lib-ruby-1_8-monitor_rb.html
  16. +2,887 −0 coverage/-usr-lib-ruby-1_8-net-http_rb.html
  17. +783 −0 coverage/-usr-lib-ruby-1_8-net-https_rb.html
  18. +1,000 −0 coverage/-usr-lib-ruby-1_8-net-protocol_rb.html
  19. +645 −0 coverage/-usr-lib-ruby-1_8-openssl-bn_rb.html
  20. +849 −0 coverage/-usr-lib-ruby-1_8-openssl-buffering_rb.html
  21. +668 −0 coverage/-usr-lib-ruby-1_8-openssl-cipher_rb.html
  22. +659 −0 coverage/-usr-lib-ruby-1_8-openssl-digest_rb.html
  23. +745 −0 coverage/-usr-lib-ruby-1_8-openssl-ssl_rb.html
  24. +764 −0 coverage/-usr-lib-ruby-1_8-openssl-x509_rb.html
  25. +634 −0 coverage/-usr-lib-ruby-1_8-openssl_rb.html
  26. +663 −0 coverage/-usr-lib-ruby-1_8-parsedate_rb.html
  27. +1,234 −0 coverage/-usr-lib-ruby-1_8-set_rb.html
  28. +970 −0 coverage/-usr-lib-ruby-1_8-singleton_rb.html
  29. +1,407 −0 coverage/-usr-lib-ruby-1_8-time_rb.html
  30. +715 −0 coverage/-usr-lib-ruby-1_8-timeout_rb.html
  31. +1,221 −0 coverage/-usr-lib-ruby-1_8-uri-common_rb.html
  32. +758 −0 coverage/-usr-lib-ruby-1_8-uri-ftp_rb.html
  33. +1,731 −0 coverage/-usr-lib-ruby-1_8-uri-generic_rb.html
  34. +710 −0 coverage/-usr-lib-ruby-1_8-uri-http_rb.html
  35. +630 −0 coverage/-usr-lib-ruby-1_8-uri-https_rb.html
  36. +800 −0 coverage/-usr-lib-ruby-1_8-uri-ldap_rb.html
  37. +876 −0 coverage/-usr-lib-ruby-1_8-uri-mailto_rb.html
  38. +638 −0 coverage/-usr-lib-ruby-1_8-uri_rb.html
  39. +1,359 −0 coverage/index.html
Sorry, we could not display the entire diff because it was too big.
View
4 History.txt
@@ -0,0 +1,4 @@
+== 0.0.1 2009-02-18
+
+* 1 major enhancement:
+ * Initial release
View
26 Manifest.txt
@@ -0,0 +1,26 @@
+History.txt
+Manifest.txt
+README.rdoc
+Rakefile
+lib/basecamp.rb
+lib/basecamp/base.rb
+lib/basecamp/version.rb
+lib/basecamp/resource.rb
+lib/basecamp/attachment.rb
+lib/basecamp/comment.rb
+lib/basecamp/connection.rb
+lib/basecamp/message.rb
+lib/basecamp/record.rb
+lib/basecamp/time_entry.rb
+lib/basecamp/todoitem.rb
+lib/basecamp/todolist.rb
+script/destroy
+script/generate
+spec/basecamp_spec.rb
+spec/spec.opts
+spec/spec_helper.rb
+spec/lib/basecamp_base.rb
+spec/lib/basecamp_message_spec.rb
+spec/lib/basecamp_todo_item_spec.rb
+spec/lib/basecamp_todo_list_spec.rb
+tasks/rspec.rake
View
0  README
No changes.
View
89 README.rdoc
@@ -0,0 +1,89 @@
+= basecamp-rb
+
+http://github.com/turingstudio/basecamp-rb/
+
+== DESCRIPTION:
+
+A Ruby gem for working with the Basecamp web-services API.
+
+== FEATURES/PROBLEMS:
+
+
+== SYNOPSIS:
+
+The first thing you need to do is establish a connection to Basecamp. This
+requires your Basecamp site address and your login credentials. Example:
+Basecamp::Base.establish_connection!('your.grouphub.com', 'login', 'password')
+
+m = Basecamp::Message.find(8675309)
+m.title # => 'Jenny'
+
+>> Creating a Resource
+
+ m = Basecamp::Message.new(:project_id => 1037)
+ m.category_id = 7301
+ m.title = 'Message in a bottle'
+ m.body = 'Another lonely day, with no one here but me'
+ m.save # => true
+
+>> Updating a Resource
+
+ m = Basecamp::Message.find(8675309)
+ m.body = 'Changed'
+ m.save # => true
+
+>> Deleting a Resource
+
+ Basecamp::Message.delete(1037)
+
+>> Using the non-REST inteface
+
+# The non-REST interface is accessed via instance methods on the Basecamp
+# class. Ensure you've established a connection, then create a new Basecamp
+# instance and call methods on it. Examples:
+
+ basecamp = Basecamp::Base.new
+
+ basecamp.projects.length # => 5
+ basecamp.person(93832) # => #<Record(person)..>
+ basecamp.file_categories(123) # => [#<Record(file-category)>,#<Record..>]
+
+# Object attributes are accessible as methods. Example:
+
+ person = basecamp.person(93832)
+ person.first_name # => "Jason"
+
+
+== REQUIREMENTS:
+
+ xml-simple >= 1.0.11
+ activeresource >= 2.2.2
+
+== INSTALL:
+
+gem install turingstudio-basecamp-rb
+
+== LICENSE:
+
+(The MIT License)
+
+Copyright (c) 2008 The Turing Studio, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
20 Rakefile
@@ -0,0 +1,20 @@
+%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
+require File.dirname(__FILE__) + '/lib/basecamp/version'
+
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+$hoe = Hoe.new('basecamp-rb', Basecamp::VERSION) do |p|
+ p.developer('The Turing Studio, Inc.', 'support@turingstudio.com')
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
+ p.extra_deps = [
+ ['xml-simple','>= 1.0.11'],
+ ['activeresource','>= 2.2.2']
+ ]
+ p.extra_dev_deps = [
+ ['newgem', ">= #{::Newgem::VERSION}"]
+ ]
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
+end
+
+require 'newgem/tasks' # load /tasks/*.rake
+Dir['tasks/**/*.rake'].each { |t| load t }
View
59 basecamp-rb.gemspec
@@ -0,0 +1,59 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{basecamp-rb}
+ s.version = "0.0.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["The Turing Studio, Inc."]
+ s.date = %q{2009-02-25}
+
+ s.email = ["operations@turingstudio.com"]
+ s.description = %q{FIX (describe your package)}
+ s.summary = %q{FIX (describe your package)}
+ s.files = [
+ "History.txt",
+ "README.rdoc",
+ "lib/basecamp.rb",
+ "lib/basecamp/base.rb",
+ "lib/basecamp/version.rb",
+ "lib/basecamp/resource.rb",
+ "lib/basecamp/attachment.rb",
+ "lib/basecamp/comment.rb",
+ "lib/basecamp/connection.rb",
+ "lib/basecamp/message.rb",
+ "lib/basecamp/record.rb",
+ "lib/basecamp/time_entry.rb",
+ "lib/basecamp/todoitem.rb",
+ "lib/basecamp/todolist.rb",
+ "spec/basecamp_spec.rb",
+ "spec/spec.opts",
+ "spec/spec_helper.rb",
+ "spec/lib/basecamp_base.rb",
+ "spec/lib/basecamp_message_spec.rb",
+ "spec/lib/basecamp_todo_item_spec.rb",
+ "spec/lib/basecamp_todo_list_spec.rb",
+ "tasks/rspec.rake"
+ ]
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc"]
+ s.homepage = %q{http://github.com/turingstudio/basecamp-rb/}
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.1}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 2
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<xml-simple>, [">= 1.0.11"])
+ s.add_runtime_dependency(%q<activeresource>, [">= 2.2.2"])
+ else
+ s.add_dependency(%q<xml-simple>, [">= 1.0.11"])
+ s.add_dependency(%q<activeresource>, [">= 2.2.2"])
+ end
+ else
+ s.add_dependency(%q<xml-simple>, [">= 1.0.11"])
+ s.add_dependency(%q<activeresource>, [">= 2.2.2"])
+ end
+end
View
743 coverage/-usr-lib-ruby-1_8-base64_rb.html
@@ -0,0 +1,743 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>/usr/lib/ruby/1.8/base64.rb - C0 code coverage information</title>
+ <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
+ <style type='text/css'>span.cross-ref-title {
+ font-size: 140%;
+}
+span.cross-ref a {
+ text-decoration: none;
+}
+span.cross-ref {
+ background-color:#f3f7fa;
+ border: 1px dashed #333;
+ margin: 1em;
+ padding: 0.5em;
+ overflow: hidden;
+}
+a.crossref-toggle {
+ text-decoration: none;
+}
+span.marked0 {
+ background-color: rgb(185, 210, 200);
+ display: block;
+}
+span.marked1 {
+ background-color: rgb(190, 215, 205);
+ display: block;
+}
+span.inferred0 {
+ background-color: rgb(175, 200, 200);
+ display: block;
+}
+span.inferred1 {
+ background-color: rgb(180, 205, 205);
+ display: block;
+}
+span.uncovered0 {
+ background-color: rgb(225, 110, 110);
+ display: block;
+}
+span.uncovered1 {
+ background-color: rgb(235, 120, 120);
+ display: block;
+}
+span.overview {
+ border-bottom: 8px solid black;
+}
+div.overview {
+ border-bottom: 8px solid black;
+}
+body {
+ font-family: verdana, arial, helvetica;
+}
+div.footer {
+ font-size: 68%;
+ margin-top: 1.5em;
+}
+h1, h2, h3, h4, h5, h6 {
+ margin-bottom: 0.5em;
+}
+h5 {
+ margin-top: 0.5em;
+}
+.hidden {
+ display: none;
+}
+div.separator {
+ height: 10px;
+}
+/* Commented out for better readability, esp. on IE */
+/*
+table tr td, table tr th {
+ font-size: 68%;
+}
+td.value table tr td {
+ font-size: 11px;
+}
+*/
+table.percent_graph {
+ height: 12px;
+ border: #808080 1px solid;
+ empty-cells: show;
+}
+table.percent_graph td.covered {
+ height: 10px;
+ background: #00f000;
+}
+table.percent_graph td.uncovered {
+ height: 10px;
+ background: #e00000;
+}
+table.percent_graph td.NA {
+ height: 10px;
+ background: #eaeaea;
+}
+table.report {
+ border-collapse: collapse;
+ width: 100%;
+}
+table.report td.heading {
+ background: #dcecff;
+ border: #d0d0d0 1px solid;
+ font-weight: bold;
+ text-align: center;
+}
+table.report td.heading:hover {
+ background: #c0ffc0;
+}
+table.report td.text {
+ border: #d0d0d0 1px solid;
+}
+table.report td.value,
+table.report td.lines_total,
+table.report td.lines_code {
+ text-align: right;
+ border: #d0d0d0 1px solid;
+}
+table.report tr.light {
+ background-color: rgb(240, 240, 245);
+}
+table.report tr.dark {
+ background-color: rgb(230, 230, 235);
+}
+</style>
+ <script type='text/javascript'>
+// <![CDATA[
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make cross-references hidden by default
+ document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
+ // ]]>
+</script>
+ <style type='text/css'>span.run0 {
+ background-color: rgb(178, 204, 255);
+ display: block;
+}
+span.run1 {
+ background-color: rgb(178, 206, 255);
+ display: block;
+}
+span.run2 {
+ background-color: rgb(178, 209, 255);
+ display: block;
+}
+span.run3 {
+ background-color: rgb(178, 211, 255);
+ display: block;
+}
+span.run4 {
+ background-color: rgb(178, 214, 255);
+ display: block;
+}
+span.run5 {
+ background-color: rgb(178, 218, 255);
+ display: block;
+}
+span.run6 {
+ background-color: rgb(178, 220, 255);
+ display: block;
+}
+span.run7 {
+ background-color: rgb(178, 223, 255);
+ display: block;
+}
+span.run8 {
+ background-color: rgb(178, 225, 255);
+ display: block;
+}
+span.run9 {
+ background-color: rgb(178, 228, 255);
+ display: block;
+}
+span.run10 {
+ background-color: rgb(178, 232, 255);
+ display: block;
+}
+span.run11 {
+ background-color: rgb(178, 234, 255);
+ display: block;
+}
+span.run12 {
+ background-color: rgb(178, 237, 255);
+ display: block;
+}
+span.run13 {
+ background-color: rgb(178, 239, 255);
+ display: block;
+}
+span.run14 {
+ background-color: rgb(178, 242, 255);
+ display: block;
+}
+span.run15 {
+ background-color: rgb(178, 246, 255);
+ display: block;
+}
+span.run16 {
+ background-color: rgb(178, 248, 255);
+ display: block;
+}
+span.run17 {
+ background-color: rgb(178, 251, 255);
+ display: block;
+}
+span.run18 {
+ background-color: rgb(178, 253, 255);
+ display: block;
+}
+span.run19 {
+ background-color: rgb(178, 255, 253);
+ display: block;
+}
+span.run20 {
+ background-color: rgb(178, 255, 249);
+ display: block;
+}
+span.run21 {
+ background-color: rgb(178, 255, 247);
+ display: block;
+}
+span.run22 {
+ background-color: rgb(178, 255, 244);
+ display: block;
+}
+span.run23 {
+ background-color: rgb(178, 255, 242);
+ display: block;
+}
+span.run24 {
+ background-color: rgb(178, 255, 239);
+ display: block;
+}
+span.run25 {
+ background-color: rgb(178, 255, 235);
+ display: block;
+}
+span.run26 {
+ background-color: rgb(178, 255, 233);
+ display: block;
+}
+span.run27 {
+ background-color: rgb(178, 255, 230);
+ display: block;
+}
+span.run28 {
+ background-color: rgb(178, 255, 228);
+ display: block;
+}
+span.run29 {
+ background-color: rgb(178, 255, 225);
+ display: block;
+}
+span.run30 {
+ background-color: rgb(178, 255, 221);
+ display: block;
+}
+span.run31 {
+ background-color: rgb(178, 255, 219);
+ display: block;
+}
+span.run32 {
+ background-color: rgb(178, 255, 216);
+ display: block;
+}
+span.run33 {
+ background-color: rgb(178, 255, 214);
+ display: block;
+}
+span.run34 {
+ background-color: rgb(178, 255, 211);
+ display: block;
+}
+span.run35 {
+ background-color: rgb(178, 255, 207);
+ display: block;
+}
+span.run36 {
+ background-color: rgb(178, 255, 205);
+ display: block;
+}
+span.run37 {
+ background-color: rgb(178, 255, 202);
+ display: block;
+}
+span.run38 {
+ background-color: rgb(178, 255, 200);
+ display: block;
+}
+span.run39 {
+ background-color: rgb(178, 255, 197);
+ display: block;
+}
+span.run40 {
+ background-color: rgb(178, 255, 193);
+ display: block;
+}
+span.run41 {
+ background-color: rgb(178, 255, 191);
+ display: block;
+}
+span.run42 {
+ background-color: rgb(178, 255, 188);
+ display: block;
+}
+span.run43 {
+ background-color: rgb(178, 255, 186);
+ display: block;
+}
+span.run44 {
+ background-color: rgb(178, 255, 183);
+ display: block;
+}
+span.run45 {
+ background-color: rgb(178, 255, 179);
+ display: block;
+}
+span.run46 {
+ background-color: rgb(179, 255, 178);
+ display: block;
+}
+span.run47 {
+ background-color: rgb(182, 255, 178);
+ display: block;
+}
+span.run48 {
+ background-color: rgb(184, 255, 178);
+ display: block;
+}
+span.run49 {
+ background-color: rgb(187, 255, 178);
+ display: block;
+}
+span.run50 {
+ background-color: rgb(191, 255, 178);
+ display: block;
+}
+span.run51 {
+ background-color: rgb(193, 255, 178);
+ display: block;
+}
+span.run52 {
+ background-color: rgb(196, 255, 178);
+ display: block;
+}
+span.run53 {
+ background-color: rgb(198, 255, 178);
+ display: block;
+}
+span.run54 {
+ background-color: rgb(201, 255, 178);
+ display: block;
+}
+span.run55 {
+ background-color: rgb(205, 255, 178);
+ display: block;
+}
+span.run56 {
+ background-color: rgb(207, 255, 178);
+ display: block;
+}
+span.run57 {
+ background-color: rgb(210, 255, 178);
+ display: block;
+}
+span.run58 {
+ background-color: rgb(212, 255, 178);
+ display: block;
+}
+span.run59 {
+ background-color: rgb(215, 255, 178);
+ display: block;
+}
+span.run60 {
+ background-color: rgb(219, 255, 178);
+ display: block;
+}
+span.run61 {
+ background-color: rgb(221, 255, 178);
+ display: block;
+}
+span.run62 {
+ background-color: rgb(224, 255, 178);
+ display: block;
+}
+span.run63 {
+ background-color: rgb(226, 255, 178);
+ display: block;
+}
+span.run64 {
+ background-color: rgb(229, 255, 178);
+ display: block;
+}
+span.run65 {
+ background-color: rgb(233, 255, 178);
+ display: block;
+}
+span.run66 {
+ background-color: rgb(235, 255, 178);
+ display: block;
+}
+span.run67 {
+ background-color: rgb(238, 255, 178);
+ display: block;
+}
+span.run68 {
+ background-color: rgb(240, 255, 178);
+ display: block;
+}
+span.run69 {
+ background-color: rgb(243, 255, 178);
+ display: block;
+}
+span.run70 {
+ background-color: rgb(247, 255, 178);
+ display: block;
+}
+span.run71 {
+ background-color: rgb(249, 255, 178);
+ display: block;
+}
+span.run72 {
+ background-color: rgb(252, 255, 178);
+ display: block;
+}
+span.run73 {
+ background-color: rgb(255, 255, 178);
+ display: block;
+}
+span.run74 {
+ background-color: rgb(255, 252, 178);
+ display: block;
+}
+span.run75 {
+ background-color: rgb(255, 248, 178);
+ display: block;
+}
+span.run76 {
+ background-color: rgb(255, 246, 178);
+ display: block;
+}
+span.run77 {
+ background-color: rgb(255, 243, 178);
+ display: block;
+}
+span.run78 {
+ background-color: rgb(255, 240, 178);
+ display: block;
+}
+span.run79 {
+ background-color: rgb(255, 238, 178);
+ display: block;
+}
+span.run80 {
+ background-color: rgb(255, 234, 178);
+ display: block;
+}
+span.run81 {
+ background-color: rgb(255, 232, 178);
+ display: block;
+}
+span.run82 {
+ background-color: rgb(255, 229, 178);
+ display: block;
+}
+span.run83 {
+ background-color: rgb(255, 226, 178);
+ display: block;
+}
+span.run84 {
+ background-color: rgb(255, 224, 178);
+ display: block;
+}
+span.run85 {
+ background-color: rgb(255, 220, 178);
+ display: block;
+}
+span.run86 {
+ background-color: rgb(255, 218, 178);
+ display: block;
+}
+span.run87 {
+ background-color: rgb(255, 215, 178);
+ display: block;
+}
+span.run88 {
+ background-color: rgb(255, 212, 178);
+ display: block;
+}
+span.run89 {
+ background-color: rgb(255, 210, 178);
+ display: block;
+}
+span.run90 {
+ background-color: rgb(255, 206, 178);
+ display: block;
+}
+span.run91 {
+ background-color: rgb(255, 204, 178);
+ display: block;
+}
+span.run92 {
+ background-color: rgb(255, 201, 178);
+ display: block;
+}
+span.run93 {
+ background-color: rgb(255, 198, 178);
+ display: block;
+}
+span.run94 {
+ background-color: rgb(255, 196, 178);
+ display: block;
+}
+span.run95 {
+ background-color: rgb(255, 192, 178);
+ display: block;
+}
+span.run96 {
+ background-color: rgb(255, 189, 178);
+ display: block;
+}
+span.run97 {
+ background-color: rgb(255, 187, 178);
+ display: block;
+}
+span.run98 {
+ background-color: rgb(255, 184, 178);
+ display: block;
+}
+span.run99 {
+ background-color: rgb(255, 182, 178);
+ display: block;
+}
+span.run100 {
+ background-color: rgb(255, 178, 178);
+ display: block;
+}
+</style>
+ </head>
+ <body><h3>C0 code coverage information</h3>
+ <p>Generated on Thu Feb 26 19:12:30 +0300 2009 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
+ </p>
+ <hr/>
+ <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
+</span><span class='marked1'>and this: this line is also marked as covered.
+</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
+</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
+</span><span class='uncovered0'>Finally, here&apos;s a line marked as not executed.
+</span></pre>
+<table class='report'><thead><tr><td class='heading'>Name</td>
+ <td class='heading'>Total lines</td>
+ <td class='heading'>Lines of code</td>
+ <td class='heading'>Total coverage</td>
+ <td class='heading'>Code coverage</td>
+ </tr>
+ </thead>
+ <tbody><tr class='light'><td><a href='-usr-lib-ruby-1_8-base64_rb.html'>/usr/lib/ruby/1.8/base64.rb</a>
+ </td>
+ <td class='lines_total'><tt>133</tt>
+ </td>
+ <td class='lines_code'><tt>40</tt>
+ </td>
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>82.0%</tt>
+ &nbsp;</td>
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='82'/>
+ <td class='uncovered' width='18'/>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>40.0%</tt>
+ &nbsp;</td>
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='40'/>
+ <td class='uncovered' width='60'/>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+<pre><span class="inferred1"><a name="line1"></a> 1 #
+</span><span class="inferred0"><a name="line2"></a> 2 # = base64.rb: methods for base64-encoding and -decoding stings
+</span><span class="inferred1"><a name="line3"></a> 3 #
+</span><span class="inferred0"><a name="line4"></a> 4 # Author:: Yukihiro Matsumoto
+</span><span class="inferred1"><a name="line5"></a> 5 # Documentation:: Dave Thomas and Gavin Sinclair
+</span><span class="inferred0"><a name="line6"></a> 6 #
+</span><span class="inferred1"><a name="line7"></a> 7 # Until Ruby 1.8.1, these methods were defined at the top-level. Now
+</span><span class="inferred0"><a name="line8"></a> 8 # they are in the Base64 module but included in the top-level, where
+</span><span class="inferred1"><a name="line9"></a> 9 # their usage is deprecated.
+</span><span class="inferred0"><a name="line10"></a> 10 #
+</span><span class="inferred1"><a name="line11"></a> 11 # See Base64 for documentation.
+</span><span class="inferred0"><a name="line12"></a> 12 #
+</span><span class="inferred1"><a name="line13"></a> 13
+</span><span class="marked0"><a name="line14"></a> 14 require &quot;kconv&quot;
+</span><span class="inferred1"><a name="line15"></a> 15
+</span><span class="inferred0"><a name="line16"></a> 16
+</span><span class="inferred1"><a name="line17"></a> 17 # The Base64 module provides for the encoding (#encode64) and decoding
+</span><span class="inferred0"><a name="line18"></a> 18 # (#decode64) of binary data using a Base64 representation.
+</span><span class="inferred1"><a name="line19"></a> 19 #
+</span><span class="inferred0"><a name="line20"></a> 20 # The following particular features are also provided:
+</span><span class="inferred1"><a name="line21"></a> 21 # - encode into lines of a given length (#b64encode)
+</span><span class="inferred0"><a name="line22"></a> 22 # - decode the special format specified in RFC2047 for the
+</span><span class="inferred1"><a name="line23"></a> 23 # representation of email headers (decode_b)
+</span><span class="inferred0"><a name="line24"></a> 24 #
+</span><span class="inferred1"><a name="line25"></a> 25 # == Example
+</span><span class="inferred0"><a name="line26"></a> 26 #
+</span><span class="inferred1"><a name="line27"></a> 27 # A simple encoding and decoding.
+</span><span class="inferred0"><a name="line28"></a> 28 #
+</span><span class="inferred1"><a name="line29"></a> 29 # require &quot;base64&quot;
+</span><span class="inferred0"><a name="line30"></a> 30 #
+</span><span class="inferred1"><a name="line31"></a> 31 # enc = Base64.encode64('Send reinforcements')
+</span><span class="inferred0"><a name="line32"></a> 32 # # -&gt; &quot;U2VuZCByZWluZm9yY2VtZW50cw==\n&quot;
+</span><span class="inferred1"><a name="line33"></a> 33 # plain = Base64.decode64(enc)
+</span><span class="inferred0"><a name="line34"></a> 34 # # -&gt; &quot;Send reinforcements&quot;
+</span><span class="inferred1"><a name="line35"></a> 35 #
+</span><span class="inferred0"><a name="line36"></a> 36 # The purpose of using base64 to encode data is that it translates any
+</span><span class="inferred1"><a name="line37"></a> 37 # binary data into purely printable characters. It is specified in
+</span><span class="inferred0"><a name="line38"></a> 38 # RFC 2045 (http://www.faqs.org/rfcs/rfc2045.html).
+</span><span class="inferred1"><a name="line39"></a> 39
+</span><span class="marked0"><a name="line40"></a> 40 module Base64
+</span><span class="marked1"><a name="line41"></a> 41 module_function
+</span><span class="inferred0"><a name="line42"></a> 42
+</span><span class="inferred1"><a name="line43"></a> 43 # Returns the Base64-decoded version of +str+.
+</span><span class="inferred0"><a name="line44"></a> 44 #
+</span><span class="inferred1"><a name="line45"></a> 45 # require 'base64'
+</span><span class="inferred0"><a name="line46"></a> 46 # str = 'VGhpcyBpcyBsaW5lIG9uZQpUaGlzIG' +
+</span><span class="inferred1"><a name="line47"></a> 47 # 'lzIGxpbmUgdHdvClRoaXMgaXMgbGlu' +
+</span><span class="inferred0"><a name="line48"></a> 48 # 'ZSB0aHJlZQpBbmQgc28gb24uLi4K'
+</span><span class="inferred1"><a name="line49"></a> 49 # puts Base64.decode64(str)
+</span><span class="inferred0"><a name="line50"></a> 50 #
+</span><span class="inferred1"><a name="line51"></a> 51 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line52"></a> 52 #
+</span><span class="inferred1"><a name="line53"></a> 53 # This is line one
+</span><span class="inferred0"><a name="line54"></a> 54 # This is line two
+</span><span class="inferred1"><a name="line55"></a> 55 # This is line three
+</span><span class="inferred0"><a name="line56"></a> 56 # And so on...
+</span><span class="inferred1"><a name="line57"></a> 57
+</span><span class="marked0"><a name="line58"></a> 58 def decode64(str)
+</span><span class="uncovered1"><a name="line59"></a> 59 str.unpack(&quot;m&quot;)[0]
+</span><span class="uncovered0"><a name="line60"></a> 60 end
+</span><span class="inferred1"><a name="line61"></a> 61
+</span><span class="inferred0"><a name="line62"></a> 62
+</span><span class="inferred1"><a name="line63"></a> 63 # Decodes text formatted using a subset of RFC2047 (the one used for
+</span><span class="inferred0"><a name="line64"></a> 64 # mime-encoding mail headers).
+</span><span class="inferred1"><a name="line65"></a> 65 #
+</span><span class="inferred0"><a name="line66"></a> 66 # Only supports an encoding type of 'b' (base 64), and only supports
+</span><span class="inferred1"><a name="line67"></a> 67 # the character sets ISO-2022-JP and SHIFT_JIS (so the only two
+</span><span class="inferred0"><a name="line68"></a> 68 # encoded word sequences recognized are &lt;tt&gt;=?ISO-2022-JP?B?...=&lt;/tt&gt; and
+</span><span class="inferred1"><a name="line69"></a> 69 # &lt;tt&gt;=?SHIFT_JIS?B?...=&lt;/tt&gt;). Recognition of these sequences is case
+</span><span class="inferred0"><a name="line70"></a> 70 # insensitive.
+</span><span class="inferred1"><a name="line71"></a> 71
+</span><span class="marked0"><a name="line72"></a> 72 def decode_b(str)
+</span><span class="uncovered1"><a name="line73"></a> 73 str.gsub!(/=\?ISO-2022-JP\?B\?([!-&gt;@-~]+)\?=/i) {
+</span><span class="uncovered0"><a name="line74"></a> 74 decode64($1)
+</span><span class="uncovered1"><a name="line75"></a> 75 }
+</span><span class="uncovered0"><a name="line76"></a> 76 str = Kconv::toeuc(str)
+</span><span class="uncovered1"><a name="line77"></a> 77 str.gsub!(/=\?SHIFT_JIS\?B\?([!-&gt;@-~]+)\?=/i) {
+</span><span class="uncovered0"><a name="line78"></a> 78 decode64($1)
+</span><span class="uncovered1"><a name="line79"></a> 79 }
+</span><span class="uncovered0"><a name="line80"></a> 80 str = Kconv::toeuc(str)
+</span><span class="uncovered1"><a name="line81"></a> 81 str.gsub!(/\n/, ' ')
+</span><span class="uncovered0"><a name="line82"></a> 82 str.gsub!(/\0/, '')
+</span><span class="uncovered1"><a name="line83"></a> 83 str
+</span><span class="uncovered0"><a name="line84"></a> 84 end
+</span><span class="inferred1"><a name="line85"></a> 85
+</span><span class="inferred0"><a name="line86"></a> 86 # Returns the Base64-encoded version of +str+.
+</span><span class="inferred1"><a name="line87"></a> 87 #
+</span><span class="inferred0"><a name="line88"></a> 88 # require 'base64'
+</span><span class="inferred1"><a name="line89"></a> 89 # Base64.b64encode(&quot;Now is the time for all good coders\nto learn Ruby&quot;)
+</span><span class="inferred0"><a name="line90"></a> 90 #
+</span><span class="inferred1"><a name="line91"></a> 91 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line92"></a> 92 #
+</span><span class="inferred1"><a name="line93"></a> 93 # Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
+</span><span class="inferred0"><a name="line94"></a> 94 # UnVieQ==
+</span><span class="inferred1"><a name="line95"></a> 95
+</span><span class="marked0"><a name="line96"></a> 96 def encode64(bin)
+</span><span class="uncovered1"><a name="line97"></a> 97 [bin].pack(&quot;m&quot;)
+</span><span class="uncovered0"><a name="line98"></a> 98 end
+</span><span class="inferred1"><a name="line99"></a> 99
+</span><span class="inferred0"><a name="line100"></a>100 # _Prints_ the Base64 encoded version of +bin+ (a +String+) in lines of
+</span><span class="inferred1"><a name="line101"></a>101 # +len+ (default 60) characters.
+</span><span class="inferred0"><a name="line102"></a>102 #
+</span><span class="inferred1"><a name="line103"></a>103 # require 'base64'
+</span><span class="inferred0"><a name="line104"></a>104 # data = &quot;Now is the time for all good coders\nto learn Ruby&quot;
+</span><span class="inferred1"><a name="line105"></a>105 # Base64.b64encode(data)
+</span><span class="inferred0"><a name="line106"></a>106 #
+</span><span class="inferred1"><a name="line107"></a>107 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line108"></a>108 #
+</span><span class="inferred1"><a name="line109"></a>109 # Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
+</span><span class="inferred0"><a name="line110"></a>110 # UnVieQ==
+</span><span class="inferred1"><a name="line111"></a>111
+</span><span class="marked0"><a name="line112"></a>112 def b64encode(bin, len = 60)
+</span><span class="uncovered1"><a name="line113"></a>113 encode64(bin).scan(/.{1,#{len}}/) do
+</span><span class="uncovered0"><a name="line114"></a>114 print $&amp;, &quot;\n&quot;
+</span><span class="uncovered1"><a name="line115"></a>115 end
+</span><span class="uncovered0"><a name="line116"></a>116 end
+</span><span class="inferred1"><a name="line117"></a>117
+</span><span class="inferred0"><a name="line118"></a>118
+</span><span class="marked1"><a name="line119"></a>119 module Deprecated # :nodoc:
+</span><span class="marked0"><a name="line120"></a>120 include Base64
+</span><span class="inferred1"><a name="line121"></a>121
+</span><span class="marked0"><a name="line122"></a>122 for m in Base64.private_instance_methods(false)
+</span><span class="uncovered1"><a name="line123"></a>123 module_eval %{
+</span><span class="uncovered0"><a name="line124"></a>124 def #{m}(*args)
+</span><span class="uncovered1"><a name="line125"></a>125 warn(&quot;\#{caller(1)[0]}: #{m} is deprecated; use Base64.#{m} instead&quot;)
+</span><span class="uncovered0"><a name="line126"></a>126 super
+</span><span class="inferred1"><a name="line127"></a>127 end
+</span><span class="marked0"><a name="line128"></a>128 }
+</span><span class="inferred1"><a name="line129"></a>129 end
+</span><span class="inferred0"><a name="line130"></a>130 end
+</span><span class="inferred1"><a name="line131"></a>131 end
+</span><span class="inferred0"><a name="line132"></a>132
+</span><span class="marked1"><a name="line133"></a>133 include Base64::Deprecated
+</span></pre><hr/>
+ <p>Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'>rcov code coverage analysis tool for Ruby</a>
+ version 0.8.1.2.</p>
+<p><a href='http://validator.w3.org/check/referer'><img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88'/>
+ </a>
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'><img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px'/>
+ </a>
+ </p>
+ </body>
+ </html>
View
1,179 coverage/-usr-lib-ruby-1_8-benchmark_rb.html
@@ -0,0 +1,1179 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'><head><title>/usr/lib/ruby/1.8/benchmark.rb - C0 code coverage information</title>
+ <style type='text/css'>body { background-color: rgb(240, 240, 245); }</style>
+ <style type='text/css'>span.cross-ref-title {
+ font-size: 140%;
+}
+span.cross-ref a {
+ text-decoration: none;
+}
+span.cross-ref {
+ background-color:#f3f7fa;
+ border: 1px dashed #333;
+ margin: 1em;
+ padding: 0.5em;
+ overflow: hidden;
+}
+a.crossref-toggle {
+ text-decoration: none;
+}
+span.marked0 {
+ background-color: rgb(185, 210, 200);
+ display: block;
+}
+span.marked1 {
+ background-color: rgb(190, 215, 205);
+ display: block;
+}
+span.inferred0 {
+ background-color: rgb(175, 200, 200);
+ display: block;
+}
+span.inferred1 {
+ background-color: rgb(180, 205, 205);
+ display: block;
+}
+span.uncovered0 {
+ background-color: rgb(225, 110, 110);
+ display: block;
+}
+span.uncovered1 {
+ background-color: rgb(235, 120, 120);
+ display: block;
+}
+span.overview {
+ border-bottom: 8px solid black;
+}
+div.overview {
+ border-bottom: 8px solid black;
+}
+body {
+ font-family: verdana, arial, helvetica;
+}
+div.footer {
+ font-size: 68%;
+ margin-top: 1.5em;
+}
+h1, h2, h3, h4, h5, h6 {
+ margin-bottom: 0.5em;
+}
+h5 {
+ margin-top: 0.5em;
+}
+.hidden {
+ display: none;
+}
+div.separator {
+ height: 10px;
+}
+/* Commented out for better readability, esp. on IE */
+/*
+table tr td, table tr th {
+ font-size: 68%;
+}
+td.value table tr td {
+ font-size: 11px;
+}
+*/
+table.percent_graph {
+ height: 12px;
+ border: #808080 1px solid;
+ empty-cells: show;
+}
+table.percent_graph td.covered {
+ height: 10px;
+ background: #00f000;
+}
+table.percent_graph td.uncovered {
+ height: 10px;
+ background: #e00000;
+}
+table.percent_graph td.NA {
+ height: 10px;
+ background: #eaeaea;
+}
+table.report {
+ border-collapse: collapse;
+ width: 100%;
+}
+table.report td.heading {
+ background: #dcecff;
+ border: #d0d0d0 1px solid;
+ font-weight: bold;
+ text-align: center;
+}
+table.report td.heading:hover {
+ background: #c0ffc0;
+}
+table.report td.text {
+ border: #d0d0d0 1px solid;
+}
+table.report td.value,
+table.report td.lines_total,
+table.report td.lines_code {
+ text-align: right;
+ border: #d0d0d0 1px solid;
+}
+table.report tr.light {
+ background-color: rgb(240, 240, 245);
+}
+table.report tr.dark {
+ background-color: rgb(230, 230, 235);
+}
+</style>
+ <script type='text/javascript'>
+// <![CDATA[
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make cross-references hidden by default
+ document.writeln( "<style type=\"text/css\">span.cross-ref { display: none }</style>" )
+ // ]]>
+</script>
+ <style type='text/css'>span.run0 {
+ background-color: rgb(178, 204, 255);
+ display: block;
+}
+span.run1 {
+ background-color: rgb(178, 206, 255);
+ display: block;
+}
+span.run2 {
+ background-color: rgb(178, 209, 255);
+ display: block;
+}
+span.run3 {
+ background-color: rgb(178, 211, 255);
+ display: block;
+}
+span.run4 {
+ background-color: rgb(178, 214, 255);
+ display: block;
+}
+span.run5 {
+ background-color: rgb(178, 218, 255);
+ display: block;
+}
+span.run6 {
+ background-color: rgb(178, 220, 255);
+ display: block;
+}
+span.run7 {
+ background-color: rgb(178, 223, 255);
+ display: block;
+}
+span.run8 {
+ background-color: rgb(178, 225, 255);
+ display: block;
+}
+span.run9 {
+ background-color: rgb(178, 228, 255);
+ display: block;
+}
+span.run10 {
+ background-color: rgb(178, 232, 255);
+ display: block;
+}
+span.run11 {
+ background-color: rgb(178, 234, 255);
+ display: block;
+}
+span.run12 {
+ background-color: rgb(178, 237, 255);
+ display: block;
+}
+span.run13 {
+ background-color: rgb(178, 239, 255);
+ display: block;
+}
+span.run14 {
+ background-color: rgb(178, 242, 255);
+ display: block;
+}
+span.run15 {
+ background-color: rgb(178, 246, 255);
+ display: block;
+}
+span.run16 {
+ background-color: rgb(178, 248, 255);
+ display: block;
+}
+span.run17 {
+ background-color: rgb(178, 251, 255);
+ display: block;
+}
+span.run18 {
+ background-color: rgb(178, 253, 255);
+ display: block;
+}
+span.run19 {
+ background-color: rgb(178, 255, 253);
+ display: block;
+}
+span.run20 {
+ background-color: rgb(178, 255, 249);
+ display: block;
+}
+span.run21 {
+ background-color: rgb(178, 255, 247);
+ display: block;
+}
+span.run22 {
+ background-color: rgb(178, 255, 244);
+ display: block;
+}
+span.run23 {
+ background-color: rgb(178, 255, 242);
+ display: block;
+}
+span.run24 {
+ background-color: rgb(178, 255, 239);
+ display: block;
+}
+span.run25 {
+ background-color: rgb(178, 255, 235);
+ display: block;
+}
+span.run26 {
+ background-color: rgb(178, 255, 233);
+ display: block;
+}
+span.run27 {
+ background-color: rgb(178, 255, 230);
+ display: block;
+}
+span.run28 {
+ background-color: rgb(178, 255, 228);
+ display: block;
+}
+span.run29 {
+ background-color: rgb(178, 255, 225);
+ display: block;
+}
+span.run30 {
+ background-color: rgb(178, 255, 221);
+ display: block;
+}
+span.run31 {
+ background-color: rgb(178, 255, 219);
+ display: block;
+}
+span.run32 {
+ background-color: rgb(178, 255, 216);
+ display: block;
+}
+span.run33 {
+ background-color: rgb(178, 255, 214);
+ display: block;
+}
+span.run34 {
+ background-color: rgb(178, 255, 211);
+ display: block;
+}
+span.run35 {
+ background-color: rgb(178, 255, 207);
+ display: block;
+}
+span.run36 {
+ background-color: rgb(178, 255, 205);
+ display: block;
+}
+span.run37 {
+ background-color: rgb(178, 255, 202);
+ display: block;
+}
+span.run38 {
+ background-color: rgb(178, 255, 200);
+ display: block;
+}
+span.run39 {
+ background-color: rgb(178, 255, 197);
+ display: block;
+}
+span.run40 {
+ background-color: rgb(178, 255, 193);
+ display: block;
+}
+span.run41 {
+ background-color: rgb(178, 255, 191);
+ display: block;
+}
+span.run42 {
+ background-color: rgb(178, 255, 188);
+ display: block;
+}
+span.run43 {
+ background-color: rgb(178, 255, 186);
+ display: block;
+}
+span.run44 {
+ background-color: rgb(178, 255, 183);
+ display: block;
+}
+span.run45 {
+ background-color: rgb(178, 255, 179);
+ display: block;
+}
+span.run46 {
+ background-color: rgb(179, 255, 178);
+ display: block;
+}
+span.run47 {
+ background-color: rgb(182, 255, 178);
+ display: block;
+}
+span.run48 {
+ background-color: rgb(184, 255, 178);
+ display: block;
+}
+span.run49 {
+ background-color: rgb(187, 255, 178);
+ display: block;
+}
+span.run50 {
+ background-color: rgb(191, 255, 178);
+ display: block;
+}
+span.run51 {
+ background-color: rgb(193, 255, 178);
+ display: block;
+}
+span.run52 {
+ background-color: rgb(196, 255, 178);
+ display: block;
+}
+span.run53 {
+ background-color: rgb(198, 255, 178);
+ display: block;
+}
+span.run54 {
+ background-color: rgb(201, 255, 178);
+ display: block;
+}
+span.run55 {
+ background-color: rgb(205, 255, 178);
+ display: block;
+}
+span.run56 {
+ background-color: rgb(207, 255, 178);
+ display: block;
+}
+span.run57 {
+ background-color: rgb(210, 255, 178);
+ display: block;
+}
+span.run58 {
+ background-color: rgb(212, 255, 178);
+ display: block;
+}
+span.run59 {
+ background-color: rgb(215, 255, 178);
+ display: block;
+}
+span.run60 {
+ background-color: rgb(219, 255, 178);
+ display: block;
+}
+span.run61 {
+ background-color: rgb(221, 255, 178);
+ display: block;
+}
+span.run62 {
+ background-color: rgb(224, 255, 178);
+ display: block;
+}
+span.run63 {
+ background-color: rgb(226, 255, 178);
+ display: block;
+}
+span.run64 {
+ background-color: rgb(229, 255, 178);
+ display: block;
+}
+span.run65 {
+ background-color: rgb(233, 255, 178);
+ display: block;
+}
+span.run66 {
+ background-color: rgb(235, 255, 178);
+ display: block;
+}
+span.run67 {
+ background-color: rgb(238, 255, 178);
+ display: block;
+}
+span.run68 {
+ background-color: rgb(240, 255, 178);
+ display: block;
+}
+span.run69 {
+ background-color: rgb(243, 255, 178);
+ display: block;
+}
+span.run70 {
+ background-color: rgb(247, 255, 178);
+ display: block;
+}
+span.run71 {
+ background-color: rgb(249, 255, 178);
+ display: block;
+}
+span.run72 {
+ background-color: rgb(252, 255, 178);
+ display: block;
+}
+span.run73 {
+ background-color: rgb(255, 255, 178);
+ display: block;
+}
+span.run74 {
+ background-color: rgb(255, 252, 178);
+ display: block;
+}
+span.run75 {
+ background-color: rgb(255, 248, 178);
+ display: block;
+}
+span.run76 {
+ background-color: rgb(255, 246, 178);
+ display: block;
+}
+span.run77 {
+ background-color: rgb(255, 243, 178);
+ display: block;
+}
+span.run78 {
+ background-color: rgb(255, 240, 178);
+ display: block;
+}
+span.run79 {
+ background-color: rgb(255, 238, 178);
+ display: block;
+}
+span.run80 {
+ background-color: rgb(255, 234, 178);
+ display: block;
+}
+span.run81 {
+ background-color: rgb(255, 232, 178);
+ display: block;
+}
+span.run82 {
+ background-color: rgb(255, 229, 178);
+ display: block;
+}
+span.run83 {
+ background-color: rgb(255, 226, 178);
+ display: block;
+}
+span.run84 {
+ background-color: rgb(255, 224, 178);
+ display: block;
+}
+span.run85 {
+ background-color: rgb(255, 220, 178);
+ display: block;
+}
+span.run86 {
+ background-color: rgb(255, 218, 178);
+ display: block;
+}
+span.run87 {
+ background-color: rgb(255, 215, 178);
+ display: block;
+}
+span.run88 {
+ background-color: rgb(255, 212, 178);
+ display: block;
+}
+span.run89 {
+ background-color: rgb(255, 210, 178);
+ display: block;
+}
+span.run90 {
+ background-color: rgb(255, 206, 178);
+ display: block;
+}
+span.run91 {
+ background-color: rgb(255, 204, 178);
+ display: block;
+}
+span.run92 {
+ background-color: rgb(255, 201, 178);
+ display: block;
+}
+span.run93 {
+ background-color: rgb(255, 198, 178);
+ display: block;
+}
+span.run94 {
+ background-color: rgb(255, 196, 178);
+ display: block;
+}
+span.run95 {
+ background-color: rgb(255, 192, 178);
+ display: block;
+}
+span.run96 {
+ background-color: rgb(255, 189, 178);
+ display: block;
+}
+span.run97 {
+ background-color: rgb(255, 187, 178);
+ display: block;
+}
+span.run98 {
+ background-color: rgb(255, 184, 178);
+ display: block;
+}
+span.run99 {
+ background-color: rgb(255, 182, 178);
+ display: block;
+}
+span.run100 {
+ background-color: rgb(255, 178, 178);
+ display: block;
+}
+</style>
+ </head>
+ <body><h3>C0 code coverage information</h3>
+ <p>Generated on Thu Feb 26 19:12:30 +0300 2009 with <a href='http://eigenclass.org/hiki/rcov'>rcov 0.8.1.2</a>
+ </p>
+ <hr/>
+ <pre><span class='marked0'>Code reported as executed by Ruby looks like this...
+</span><span class='marked1'>and this: this line is also marked as covered.
+</span><span class='inferred0'>Lines considered as run by rcov, but not reported by Ruby, look like this,
+</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).
+</span><span class='uncovered0'>Finally, here&apos;s a line marked as not executed.
+</span></pre>
+<table class='report'><thead><tr><td class='heading'>Name</td>
+ <td class='heading'>Total lines</td>
+ <td class='heading'>Lines of code</td>
+ <td class='heading'>Total coverage</td>
+ <td class='heading'>Code coverage</td>
+ </tr>
+ </thead>
+ <tbody><tr class='light'><td><a href='-usr-lib-ruby-1_8-benchmark_rb.html'>/usr/lib/ruby/1.8/benchmark.rb</a>
+ </td>
+ <td class='lines_total'><tt>569</tt>
+ </td>
+ <td class='lines_code'><tt>186</tt>
+ </td>
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_total'>77.0%</tt>
+ &nbsp;</td>
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='77'/>
+ <td class='uncovered' width='23'/>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td><table cellspacing='0' cellpadding='0' align='right'><tr><td><tt class='coverage_code'>33.3%</tt>
+ &nbsp;</td>
+ <td><table cellspacing='0' class='percent_graph' cellpadding='0' width='100'><tr><td class='covered' width='33'/>
+ <td class='uncovered' width='67'/>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+<pre><span class="inferred0"><a name="line1"></a> 1 =begin
+</span><span class="inferred1"><a name="line2"></a> 2 #
+</span><span class="inferred0"><a name="line3"></a> 3 # benchmark.rb - a performance benchmarking library
+</span><span class="inferred1"><a name="line4"></a> 4 #
+</span><span class="inferred0"><a name="line5"></a> 5 # $Id: benchmark.rb 11708 2007-02-12 23:01:19Z shyouhei $
+</span><span class="inferred1"><a name="line6"></a> 6 #
+</span><span class="inferred0"><a name="line7"></a> 7 # Created by Gotoken (gotoken@notwork.org).
+</span><span class="inferred1"><a name="line8"></a> 8 #
+</span><span class="inferred0"><a name="line9"></a> 9 # Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and
+</span><span class="inferred1"><a name="line10"></a> 10 # Gavin Sinclair (editing).
+</span><span class="inferred0"><a name="line11"></a> 11 #
+</span><span class="inferred1"><a name="line12"></a> 12 =end
+</span><span class="inferred0"><a name="line13"></a> 13
+</span><span class="inferred1"><a name="line14"></a> 14 # == Overview
+</span><span class="inferred0"><a name="line15"></a> 15 #
+</span><span class="inferred1"><a name="line16"></a> 16 # The Benchmark module provides methods for benchmarking Ruby code, giving
+</span><span class="inferred0"><a name="line17"></a> 17 # detailed reports on the time taken for each task.
+</span><span class="inferred1"><a name="line18"></a> 18 #
+</span><span class="inferred0"><a name="line19"></a> 19
+</span><span class="inferred1"><a name="line20"></a> 20 # The Benchmark module provides methods to measure and report the time
+</span><span class="inferred0"><a name="line21"></a> 21 # used to execute Ruby code.
+</span><span class="inferred1"><a name="line22"></a> 22 #
+</span><span class="inferred0"><a name="line23"></a> 23 # * Measure the time to construct the string given by the expression
+</span><span class="inferred1"><a name="line24"></a> 24 # &lt;tt&gt;&quot;a&quot;*1_000_000&lt;/tt&gt;:
+</span><span class="inferred0"><a name="line25"></a> 25 #
+</span><span class="inferred1"><a name="line26"></a> 26 # require 'benchmark'
+</span><span class="inferred0"><a name="line27"></a> 27 #
+</span><span class="inferred1"><a name="line28"></a> 28 # puts Benchmark.measure { &quot;a&quot;*1_000_000 }
+</span><span class="inferred0"><a name="line29"></a> 29 #
+</span><span class="inferred1"><a name="line30"></a> 30 # On my machine (FreeBSD 3.2 on P5, 100MHz) this generates:
+</span><span class="inferred0"><a name="line31"></a> 31 #
+</span><span class="inferred1"><a name="line32"></a> 32 # 1.166667 0.050000 1.216667 ( 0.571355)
+</span><span class="inferred0"><a name="line33"></a> 33 #
+</span><span class="inferred1"><a name="line34"></a> 34 # This report shows the user CPU time, system CPU time, the sum of
+</span><span class="inferred0"><a name="line35"></a> 35 # the user and system CPU times, and the elapsed real time. The unit
+</span><span class="inferred1"><a name="line36"></a> 36 # of time is seconds.
+</span><span class="inferred0"><a name="line37"></a> 37 #
+</span><span class="inferred1"><a name="line38"></a> 38 # * Do some experiments sequentially using the #bm method:
+</span><span class="inferred0"><a name="line39"></a> 39 #
+</span><span class="inferred1"><a name="line40"></a> 40 # require 'benchmark'
+</span><span class="inferred0"><a name="line41"></a> 41 #
+</span><span class="inferred1"><a name="line42"></a> 42 # n = 50000
+</span><span class="inferred0"><a name="line43"></a> 43 # Benchmark.bm do |x|
+</span><span class="inferred1"><a name="line44"></a> 44 # x.report { for i in 1..n; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line45"></a> 45 # x.report { n.times do ; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line46"></a> 46 # x.report { 1.upto(n) do ; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line47"></a> 47 # end
+</span><span class="inferred1"><a name="line48"></a> 48 #
+</span><span class="inferred0"><a name="line49"></a> 49 # The result:
+</span><span class="inferred1"><a name="line50"></a> 50 #
+</span><span class="inferred0"><a name="line51"></a> 51 # user system total real
+</span><span class="inferred1"><a name="line52"></a> 52 # 1.033333 0.016667 1.016667 ( 0.492106)
+</span><span class="inferred0"><a name="line53"></a> 53 # 1.483333 0.000000 1.483333 ( 0.694605)
+</span><span class="inferred1"><a name="line54"></a> 54 # 1.516667 0.000000 1.516667 ( 0.711077)
+</span><span class="inferred0"><a name="line55"></a> 55 #
+</span><span class="inferred1"><a name="line56"></a> 56 # * Continuing the previous example, put a label in each report:
+</span><span class="inferred0"><a name="line57"></a> 57 #
+</span><span class="inferred1"><a name="line58"></a> 58 # require 'benchmark'
+</span><span class="inferred0"><a name="line59"></a> 59 #
+</span><span class="inferred1"><a name="line60"></a> 60 # n = 50000
+</span><span class="inferred0"><a name="line61"></a> 61 # Benchmark.bm(7) do |x|
+</span><span class="inferred1"><a name="line62"></a> 62 # x.report(&quot;for:&quot;) { for i in 1..n; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line63"></a> 63 # x.report(&quot;times:&quot;) { n.times do ; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line64"></a> 64 # x.report(&quot;upto:&quot;) { 1.upto(n) do ; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line65"></a> 65 # end
+</span><span class="inferred1"><a name="line66"></a> 66 #
+</span><span class="inferred0"><a name="line67"></a> 67 # The result:
+</span><span class="inferred1"><a name="line68"></a> 68 #
+</span><span class="inferred0"><a name="line69"></a> 69 # user system total real
+</span><span class="inferred1"><a name="line70"></a> 70 # for: 1.050000 0.000000 1.050000 ( 0.503462)
+</span><span class="inferred0"><a name="line71"></a> 71 # times: 1.533333 0.016667 1.550000 ( 0.735473)
+</span><span class="inferred1"><a name="line72"></a> 72 # upto: 1.500000 0.016667 1.516667 ( 0.711239)
+</span><span class="inferred0"><a name="line73"></a> 73 #
+</span><span class="inferred1"><a name="line74"></a> 74 #
+</span><span class="inferred0"><a name="line75"></a> 75 # * The times for some benchmarks depend on the order in which items
+</span><span class="inferred1"><a name="line76"></a> 76 # are run. These differences are due to the cost of memory
+</span><span class="inferred0"><a name="line77"></a> 77 # allocation and garbage collection. To avoid these discrepancies,
+</span><span class="inferred1"><a name="line78"></a> 78 # the #bmbm method is provided. For example, to compare ways to
+</span><span class="inferred0"><a name="line79"></a> 79 # sort an array of floats:
+</span><span class="inferred1"><a name="line80"></a> 80 #
+</span><span class="inferred0"><a name="line81"></a> 81 # require 'benchmark'
+</span><span class="inferred1"><a name="line82"></a> 82 #
+</span><span class="inferred0"><a name="line83"></a> 83 # array = (1..1000000).map { rand }
+</span><span class="inferred1"><a name="line84"></a> 84 #
+</span><span class="inferred0"><a name="line85"></a> 85 # Benchmark.bmbm do |x|
+</span><span class="inferred1"><a name="line86"></a> 86 # x.report(&quot;sort!&quot;) { array.dup.sort! }
+</span><span class="inferred0"><a name="line87"></a> 87 # x.report(&quot;sort&quot;) { array.dup.sort }
+</span><span class="inferred1"><a name="line88"></a> 88 # end
+</span><span class="inferred0"><a name="line89"></a> 89 #
+</span><span class="inferred1"><a name="line90"></a> 90 # The result:
+</span><span class="inferred0"><a name="line91"></a> 91 #
+</span><span class="inferred1"><a name="line92"></a> 92 # Rehearsal -----------------------------------------
+</span><span class="inferred0"><a name="line93"></a> 93 # sort! 11.928000 0.010000 11.938000 ( 12.756000)
+</span><span class="inferred1"><a name="line94"></a> 94 # sort 13.048000 0.020000 13.068000 ( 13.857000)
+</span><span class="inferred0"><a name="line95"></a> 95 # ------------------------------- total: 25.006000sec
+</span><span class="inferred1"><a name="line96"></a> 96 #
+</span><span class="inferred0"><a name="line97"></a> 97 # user system total real
+</span><span class="inferred1"><a name="line98"></a> 98 # sort! 12.959000 0.010000 12.969000 ( 13.793000)
+</span><span class="inferred0"><a name="line99"></a> 99 # sort 12.007000 0.000000 12.007000 ( 12.791000)
+</span><span class="inferred1"><a name="line100"></a>100 #
+</span><span class="inferred0"><a name="line101"></a>101 #
+</span><span class="inferred1"><a name="line102"></a>102 # * Report statistics of sequential experiments with unique labels,
+</span><span class="inferred0"><a name="line103"></a>103 # using the #benchmark method:
+</span><span class="inferred1"><a name="line104"></a>104 #
+</span><span class="inferred0"><a name="line105"></a>105 # require 'benchmark'
+</span><span class="inferred1"><a name="line106"></a>106 #
+</span><span class="inferred0"><a name="line107"></a>107 # n = 50000
+</span><span class="inferred1"><a name="line108"></a>108 # Benchmark.benchmark(&quot; &quot;*7 + CAPTION, 7, FMTSTR, &quot;&gt;total:&quot;, &quot;&gt;avg:&quot;) do |x|
+</span><span class="inferred0"><a name="line109"></a>109 # tf = x.report(&quot;for:&quot;) { for i in 1..n; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line110"></a>110 # tt = x.report(&quot;times:&quot;) { n.times do ; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line111"></a>111 # tu = x.report(&quot;upto:&quot;) { 1.upto(n) do ; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line112"></a>112 # [tf+tt+tu, (tf+tt+tu)/3]
+</span><span class="inferred0"><a name="line113"></a>113 # end
+</span><span class="inferred1"><a name="line114"></a>114 #
+</span><span class="inferred0"><a name="line115"></a>115 # The result:
+</span><span class="inferred1"><a name="line116"></a>116 #
+</span><span class="inferred0"><a name="line117"></a>117 # user system total real
+</span><span class="inferred1"><a name="line118"></a>118 # for: 1.016667 0.016667 1.033333 ( 0.485749)
+</span><span class="inferred0"><a name="line119"></a>119 # times: 1.450000 0.016667 1.466667 ( 0.681367)
+</span><span class="inferred1"><a name="line120"></a>120 # upto: 1.533333 0.000000 1.533333 ( 0.722166)
+</span><span class="inferred0"><a name="line121"></a>121 # &gt;total: 4.000000 0.033333 4.033333 ( 1.889282)
+</span><span class="inferred1"><a name="line122"></a>122 # &gt;avg: 1.333333 0.011111 1.344444 ( 0.629761)
+</span><span class="inferred0"><a name="line123"></a>123
+</span><span class="marked1"><a name="line124"></a>124 module Benchmark
+</span><span class="inferred0"><a name="line125"></a>125
+</span><span class="marked1"><a name="line126"></a>126 BENCHMARK_VERSION = &quot;2002-04-25&quot; #:nodoc&quot;
+</span><span class="inferred0"><a name="line127"></a>127
+</span><span class="marked1"><a name="line128"></a>128 def Benchmark::times() # :nodoc:
+</span><span class="uncovered0"><a name="line129"></a>129 Process::times()
+</span><span class="uncovered1"><a name="line130"></a>130 end
+</span><span class="inferred0"><a name="line131"></a>131
+</span><span class="inferred1"><a name="line132"></a>132
+</span><span class="inferred0"><a name="line133"></a>133 # Invokes the block with a &lt;tt&gt;Benchmark::Report&lt;/tt&gt; object, which
+</span><span class="inferred1"><a name="line134"></a>134 # may be used to collect and report on the results of individual
+</span><span class="inferred0"><a name="line135"></a>135 # benchmark tests. Reserves &lt;i&gt;label_width&lt;/i&gt; leading spaces for
+</span><span class="inferred1"><a name="line136"></a>136 # labels on each line. Prints _caption_ at the top of the
+</span><span class="inferred0"><a name="line137"></a>137 # report, and uses _fmt_ to format each line.
+</span><span class="inferred1"><a name="line138"></a>138 # If the block returns an array of
+</span><span class="inferred0"><a name="line139"></a>139 # &lt;tt&gt;Benchmark::Tms&lt;/tt&gt; objects, these will be used to format
+</span><span class="inferred1"><a name="line140"></a>140 # additional lines of output. If _label_ parameters are
+</span><span class="inferred0"><a name="line141"></a>141 # given, these are used to label these extra lines.
+</span><span class="inferred1"><a name="line142"></a>142 #
+</span><span class="inferred0"><a name="line143"></a>143 # _Note_: Other methods provide a simpler interface to this one, and are
+</span><span class="inferred1"><a name="line144"></a>144 # suitable for nearly all benchmarking requirements. See the examples in
+</span><span class="inferred0"><a name="line145"></a>145 # Benchmark, and the #bm and #bmbm methods.
+</span><span class="inferred1"><a name="line146"></a>146 #
+</span><span class="inferred0"><a name="line147"></a>147 # Example:
+</span><span class="inferred1"><a name="line148"></a>148 #
+</span><span class="inferred0"><a name="line149"></a>149 # require 'benchmark'
+</span><span class="inferred1"><a name="line150"></a>150 # include Benchmark # we need the CAPTION and FMTSTR constants
+</span><span class="inferred0"><a name="line151"></a>151 #
+</span><span class="inferred1"><a name="line152"></a>152 # n = 50000
+</span><span class="inferred0"><a name="line153"></a>153 # Benchmark.benchmark(&quot; &quot;*7 + CAPTION, 7, FMTSTR, &quot;&gt;total:&quot;, &quot;&gt;avg:&quot;) do |x|
+</span><span class="inferred1"><a name="line154"></a>154 # tf = x.report(&quot;for:&quot;) { for i in 1..n; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line155"></a>155 # tt = x.report(&quot;times:&quot;) { n.times do ; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line156"></a>156 # tu = x.report(&quot;upto:&quot;) { 1.upto(n) do ; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line157"></a>157 # [tf+tt+tu, (tf+tt+tu)/3]
+</span><span class="inferred1"><a name="line158"></a>158 # end
+</span><span class="inferred0"><a name="line159"></a>159 #
+</span><span class="inferred1"><a name="line160"></a>160 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line161"></a>161 #
+</span><span class="inferred1"><a name="line162"></a>162 # user system total real
+</span><span class="inferred0"><a name="line163"></a>163 # for: 1.016667 0.016667 1.033333 ( 0.485749)
+</span><span class="inferred1"><a name="line164"></a>164 # times: 1.450000 0.016667 1.466667 ( 0.681367)
+</span><span class="inferred0"><a name="line165"></a>165 # upto: 1.533333 0.000000 1.533333 ( 0.722166)
+</span><span class="inferred1"><a name="line166"></a>166 # &gt;total: 4.000000 0.033333 4.033333 ( 1.889282)
+</span><span class="inferred0"><a name="line167"></a>167 # &gt;avg: 1.333333 0.011111 1.344444 ( 0.629761)
+</span><span class="inferred1"><a name="line168"></a>168 #
+</span><span class="inferred0"><a name="line169"></a>169
+</span><span class="marked1"><a name="line170"></a>170 def benchmark(caption = &quot;&quot;, label_width = nil, fmtstr = nil, *labels) # :yield: report
+</span><span class="uncovered0"><a name="line171"></a>171 sync = STDOUT.sync
+</span><span class="uncovered1"><a name="line172"></a>172 STDOUT.sync = true
+</span><span class="uncovered0"><a name="line173"></a>173 label_width ||= 0
+</span><span class="uncovered1"><a name="line174"></a>174 fmtstr ||= FMTSTR
+</span><span class="uncovered0"><a name="line175"></a>175 raise ArgumentError, &quot;no block&quot; unless iterator?
+</span><span class="uncovered1"><a name="line176"></a>176 print caption
+</span><span class="uncovered0"><a name="line177"></a>177 results = yield(Report.new(label_width, fmtstr))
+</span><span class="uncovered1"><a name="line178"></a>178 Array === results and results.grep(Tms).each {|t|
+</span><span class="uncovered0"><a name="line179"></a>179 print((labels.shift || t.label || &quot;&quot;).ljust(label_width),
+</span><span class="uncovered1"><a name="line180"></a>180 t.format(fmtstr))
+</span><span class="uncovered0"><a name="line181"></a>181 }
+</span><span class="uncovered1"><a name="line182"></a>182 STDOUT.sync = sync
+</span><span class="uncovered0"><a name="line183"></a>183 end
+</span><span class="inferred1"><a name="line184"></a>184
+</span><span class="inferred0"><a name="line185"></a>185
+</span><span class="inferred1"><a name="line186"></a>186 # A simple interface to the #benchmark method, #bm is generates sequential reports
+</span><span class="inferred0"><a name="line187"></a>187 # with labels. The parameters have the same meaning as for #benchmark.
+</span><span class="inferred1"><a name="line188"></a>188 #
+</span><span class="inferred0"><a name="line189"></a>189 # require 'benchmark'
+</span><span class="inferred1"><a name="line190"></a>190 #
+</span><span class="inferred0"><a name="line191"></a>191 # n = 50000
+</span><span class="inferred1"><a name="line192"></a>192 # Benchmark.bm(7) do |x|
+</span><span class="inferred0"><a name="line193"></a>193 # x.report(&quot;for:&quot;) { for i in 1..n; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line194"></a>194 # x.report(&quot;times:&quot;) { n.times do ; a = &quot;1&quot;; end }
+</span><span class="inferred0"><a name="line195"></a>195 # x.report(&quot;upto:&quot;) { 1.upto(n) do ; a = &quot;1&quot;; end }
+</span><span class="inferred1"><a name="line196"></a>196 # end
+</span><span class="inferred0"><a name="line197"></a>197 #
+</span><span class="inferred1"><a name="line198"></a>198 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line199"></a>199 #
+</span><span class="inferred1"><a name="line200"></a>200 # user system total real
+</span><span class="inferred0"><a name="line201"></a>201 # for: 1.050000 0.000000 1.050000 ( 0.503462)
+</span><span class="inferred1"><a name="line202"></a>202 # times: 1.533333 0.016667 1.550000 ( 0.735473)
+</span><span class="inferred0"><a name="line203"></a>203 # upto: 1.500000 0.016667 1.516667 ( 0.711239)
+</span><span class="inferred1"><a name="line204"></a>204 #
+</span><span class="inferred0"><a name="line205"></a>205
+</span><span class="marked1"><a name="line206"></a>206 def bm(label_width = 0, *labels, &amp;blk) # :yield: report
+</span><span class="uncovered0"><a name="line207"></a>207 benchmark(&quot; &quot;*label_width + CAPTION, label_width, FMTSTR, *labels, &amp;blk)
+</span><span class="uncovered1"><a name="line208"></a>208 end
+</span><span class="inferred0"><a name="line209"></a>209
+</span><span class="inferred1"><a name="line210"></a>210
+</span><span class="inferred0"><a name="line211"></a>211 # Sometimes benchmark results are skewed because code executed
+</span><span class="inferred1"><a name="line212"></a>212 # earlier encounters different garbage collection overheads than
+</span><span class="inferred0"><a name="line213"></a>213 # that run later. #bmbm attempts to minimize this effect by running
+</span><span class="inferred1"><a name="line214"></a>214 # the tests twice, the first time as a rehearsal in order to get the
+</span><span class="inferred0"><a name="line215"></a>215 # runtime environment stable, the second time for
+</span><span class="inferred1"><a name="line216"></a>216 # real. &lt;tt&gt;GC.start&lt;/tt&gt; is executed before the start of each of
+</span><span class="inferred0"><a name="line217"></a>217 # the real timings; the cost of this is not included in the
+</span><span class="inferred1"><a name="line218"></a>218 # timings. In reality, though, there's only so much that #bmbm can
+</span><span class="inferred0"><a name="line219"></a>219 # do, and the results are not guaranteed to be isolated from garbage
+</span><span class="inferred1"><a name="line220"></a>220 # collection and other effects.
+</span><span class="inferred0"><a name="line221"></a>221 #
+</span><span class="inferred1"><a name="line222"></a>222 # Because #bmbm takes two passes through the tests, it can
+</span><span class="inferred0"><a name="line223"></a>223 # calculate the required label width.
+</span><span class="inferred1"><a name="line224"></a>224 #
+</span><span class="inferred0"><a name="line225"></a>225 # require 'benchmark'
+</span><span class="inferred1"><a name="line226"></a>226 #
+</span><span class="inferred0"><a name="line227"></a>227 # array = (1..1000000).map { rand }
+</span><span class="inferred1"><a name="line228"></a>228 #
+</span><span class="inferred0"><a name="line229"></a>229 # Benchmark.bmbm do |x|
+</span><span class="inferred1"><a name="line230"></a>230 # x.report(&quot;sort!&quot;) { array.dup.sort! }
+</span><span class="inferred0"><a name="line231"></a>231 # x.report(&quot;sort&quot;) { array.dup.sort }
+</span><span class="inferred1"><a name="line232"></a>232 # end
+</span><span class="inferred0"><a name="line233"></a>233 #
+</span><span class="inferred1"><a name="line234"></a>234 # &lt;i&gt;Generates:&lt;/i&gt;
+</span><span class="inferred0"><a name="line235"></a>235 #
+</span><span class="inferred1"><a name="line236"></a>236 # Rehearsal -----------------------------------------
+</span><span class="inferred0"><a name="line237"></a>237 # sort! 11.928000 0.010000 11.938000 ( 12.756000)
+</span><span class="inferred1"><a name="line238"></a>238 # sort 13.048000 0.020000 13.068000 ( 13.857000)
+</span><span class="inferred0"><a name="line239"></a>239 # ------------------------------- total: 25.006000sec
+</span><span class="inferred1"><a name="line240"></a>240 #
+</span><span class="inferred0"><a name="line241"></a>241 # user system total real
+</span><span class="inferred1"><a name="line242"></a>242 # sort! 12.959000 0.010000 12.969000 ( 13.793000)
+</span><span class="inferred0"><a name="line243"></a>243 # sort 12.007000 0.000000 12.007000 ( 12.791000)
+</span><span class="inferred1"><a name="line244"></a>244 #
+</span><span class="inferred0"><a name="line245"></a>245 # #bmbm yields a Benchmark::Job object and returns an array of
+</span><span class="inferred1"><a name="line246"></a>246 # Benchmark::Tms objects.
+</span><span class="inferred0"><a name="line247"></a>247 #
+</span><span class="marked1"><a name="line248"></a>248 def bmbm(width = 0, &amp;blk) # :yield: job
+</span><span class="uncovered0"><a name="line249"></a>249 job = Job.new(width)
+</span><span class="uncovered1"><a name="line250"></a>250 yield(job)
+</span><span class="uncovered0"><a name="line251"></a>251 width = job.width
+</span><span class="uncovered1"><a name="line252"></a>252 sync = STDOUT.sync
+</span><span class="uncovered0"><a name="line253"></a>253 STDOUT.sync = true
+</span><span class="uncovered1"><a name="line254"></a>254
+</span><span class="uncovered0"><a name="line255"></a>255 # rehearsal
+</span><span class="uncovered1"><a name="line256"></a>256 print &quot;Rehearsal &quot;
+</span><span class="uncovered0"><a name="line257"></a>257 puts '-'*(width+CAPTION.length - &quot;Rehearsal &quot;.length)
+</span><span class="uncovered1"><a name="line258"></a>258 list = []
+</span><span class="uncovered0"><a name="line259"></a>259 job.list.each{|label,item|
+</span><span class="uncovered1"><a name="line260"></a>260 print(label.ljust(width))
+</span><span class="uncovered0"><a name="line261"></a>261 res = Benchmark::measure(&amp;item)
+</span><span class="uncovered1"><a name="line262"></a>262 print res.format()
+</span><span class="uncovered0"><a name="line263"></a>263 list.push res
+</span><span class="uncovered1"><a name="line264"></a>264 }
+</span><span class="uncovered0"><a name="line265"></a>265 sum = Tms.new; list.each{|i| sum += i}
+</span><span class="uncovered1"><a name="line266"></a>266 ets = sum.format(&quot;total: %tsec&quot;)
+</span><span class="uncovered0"><a name="line267"></a>267 printf(&quot;%s %s\n\n&quot;,
+</span><span class="uncovered1"><a name="line268"></a>268 &quot;-&quot;*(width+CAPTION.length-ets.length-1), ets)
+</span><span class="uncovered0"><a name="line269"></a>269
+</span><span class="uncovered1"><a name="line270"></a>270 # take
+</span><span class="uncovered0"><a name="line271"></a>271 print ' '*width, CAPTION
+</span><span class="uncovered1"><a name="line272"></a>272 list = []
+</span><span class="uncovered0"><a name="line273"></a>273 ary = []
+</span><span class="uncovered1"><a name="line274"></a>274 job.list.each{|label,item|
+</span><span class="uncovered0"><a name="line275"></a>275 GC::start
+</span><span class="uncovered1"><a name="line276"></a>276 print label.ljust(width)
+</span><span class="uncovered0"><a name="line277"></a>277 res = Benchmark::measure(&amp;item)
+</span><span class="uncovered1"><a name="line278"></a>278 print res.format()
+</span><span class="uncovered0"><a name="line279"></a>279 ary.push res
+</span><span class="uncovered1"><a name="line280"></a>280 list.push [label, res]
+</span><span class="uncovered0"><a name="line281"></a>281 }
+</span><span class="uncovered1"><a name="line282"></a>282
+</span><span class="uncovered0"><a name="line283"></a>283 STDOUT.sync = sync
+</span><span class="uncovered1"><a name="line284"></a>284 ary
+</span><span class="uncovered0"><a name="line285"></a>285 end
+</span><span class="inferred1"><a name="line286"></a>286
+</span><span class="inferred0"><a name="line287"></a>287 #
+</span><span class="inferred1"><a name="line288"></a>288 # Returns the time used to execute the given block as a
+</span><span class="inferred0"><a name="line289"></a>289 # Benchmark::Tms object.
+</span><span class="inferred1"><a name="line290"></a>290 #
+</span><span class="marked0"><a name="line291"></a>291 def measure(label = &quot;&quot;) # :yield:
+</span><span class="uncovered1"><a name="line292"></a>292 t0, r0 = Benchmark.times, Time.now
+</span><span class="uncovered0"><a name="line293"></a>293 yield
+</span><span class="uncovered1"><a name="line294"></a>294 t1, r1 = Benchmark.times, Time.now
+</span><span class="uncovered0"><a name="line295"></a>295 Benchmark::Tms.new(t1.utime - t0.utime,
+</span><span class="uncovered1"><a name="line296"></a>296 t1.stime - t0.stime,
+</span><span class="uncovered0"><a name="line297"></a>297 t1.cutime - t0.cutime,
+</span><span class="uncovered1"><a name="line298"></a>298 t1.cstime - t0.cstime,
+</span><span class="uncovered0"><a name="line299"></a>299 r1.to_f - r0.to_f,
+</span><span class="uncovered1"><a name="line300"></a>300 label)
+</span><span class="uncovered0"><a name="line301"></a>301 end
+</span><span class="inferred1"><a name="line302"></a>302
+</span><span class="inferred0"><a name="line303"></a>303 #
+</span><span class="inferred1"><a name="line304"></a>304 # Returns the elapsed real time used to execute the given block.
+</span><span class="inferred0"><a name="line305"></a>305 #
+</span><span class="marked1"><a name="line306"></a>306 def realtime(&amp;blk) # :yield:
+</span><span class="uncovered0"><a name="line307"></a>307 Benchmark::measure(&amp;blk).real
+</span><span class="uncovered1"><a name="line308"></a>308 end
+</span><span class="inferred0"><a name="line309"></a>309
+</span><span class="inferred1"><a name="line310"></a>310
+</span><span class="inferred0"><a name="line311"></a>311
+</span><span class="inferred1"><a name="line312"></a>312 #
+</span><span class="inferred0"><a name="line313"></a>313 # A Job is a sequence of labelled blocks to be processed by the
+</span><span class="inferred1"><a name="line314"></a>314 # Benchmark.bmbm method. It is of little direct interest to the user.
+</span><span class="inferred0"><a name="line315"></a>315 #
+</span><span class="marked1"><a name="line316"></a>316 class Job # :nodoc:
+</span><span class="inferred0"><a name="line317"></a>317 #
+</span><span class="inferred1"><a name="line318"></a>318 # Returns an initialized Job instance.
+</span><span class="inferred0"><a name="line319"></a>319 # Usually, one doesn't call this method directly, as new
+</span><span class="inferred1"><a name="line320"></a>320 # Job objects are created by the #bmbm method.
+</span><span class="inferred0"><a name="line321"></a>321 # _width_ is a initial value for the label offset used in formatting;
+</span><span class="inferred1"><a name="line322"></a>322 # the #bmbm method passes its _width_ argument to this constructor.
+</span><span class="inferred0"><a name="line323"></a>323 #
+</span><span class="marked1"><a name="line324<