<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/test_meta_api.mkd</filename>
    </added>
    <added>
      <filename>test/test_meta_api.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -41,7 +41,7 @@ test/test_introduction.mkd
 test/test_introduction.rb
 test/test_layer_state.mkd
 test/test_layer_state.rb
+test/test_meta_api.mkd
+test/test_meta_api.rb
 test/test_ordering.mkd
 test/test_ordering.rb
-test/test_yield_next.mkd
-test/test_yield_next.rb</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@ class Foo
     true
   end
 
-  module OneMethods
+  in_layer :once do
     def once
       true
     end
@@ -35,20 +35,17 @@ class Foo
     end
   end
 
-  module TwoMethods
+  in_layer :two do
     def twice
       true
     end
   end
-
-  include OneMethods =&gt; :one,
-          TwoMethods =&gt; :two
 end
 
 f = Foo.new
 
 n = 100_000
-Benchmark.bm(20) do |x|
+Benchmark.bmbm(20) do |x|
   x.report(&quot;Ordinary:&quot;) {
     n.times { f.ordinary }
   }
@@ -75,24 +72,20 @@ Benchmark.bm(20) do |x|
 end
 
 __END__
-n = 1_000_000
+n = 100_000 (bmbm to warm up the jvm)
+
+ruby 1.8.6
                           user     system      total        real
-Ordinary:             0.410000   0.000000   0.410000 (  0.406774)
-Once (w/o):           6.080000   0.010000   6.090000 (  6.148515)
-Once (ctx):          16.560000   0.020000  16.580000 ( 16.700489)
-Twice (w/o):          6.100000   0.010000   6.110000 (  6.113543)
-Twice (ctx):         18.620000   0.010000  18.630000 ( 18.686153)
-Wrapped (w/o):        6.140000   0.010000   6.150000 (  6.152476)
-Wrapped (ctx):       29.740000   0.030000  29.770000 ( 29.816371)
-All wrappers (ctx):  37.250000   0.040000  37.290000 ( 37.344437)
+Ordinary:             0.040000   0.000000   0.040000 (  0.041294)
+Once (w/o):           1.030000   0.010000   1.040000 (  1.043971)
+Once (ctx):           1.540000   0.000000   1.540000 (  1.598743)
+Twice (w/o):          1.030000   0.010000   1.040000 (  1.055684)
+Twice (ctx):          2.780000   0.010000   2.790000 (  2.839568)
 
-n = 100_000
+jruby -O -J-server 1.0.2
                           user     system      total        real
-Ordinary:             0.040000   0.000000   0.040000 (  0.040648)
-Once (w/o):           0.610000   0.000000   0.610000 (  0.613713)
-Once (ctx):           1.660000   0.000000   1.660000 (  1.689277)
-Twice (w/o):          0.610000   0.000000   0.610000 (  0.608093)
-Twice (ctx):          1.870000   0.010000   1.880000 (  1.918604)
-Wrapped (w/o):        0.600000   0.000000   0.600000 (  0.605630)
-Wrapped (ctx):        2.960000   0.010000   2.970000 (  2.979563)
-All wrappers (ctx):   3.750000   0.000000   3.750000 (  3.761805)
+Ordinary:             0.108000   0.000000   0.108000 (  0.108000)
+Once (w/o):           2.336000   0.000000   2.336000 (  2.335000)
+Once (ctx):           3.390000   0.000000   3.390000 (  3.390000)
+Twice (w/o):          2.439000   0.000000   2.439000 (  2.439000)
+Twice (ctx):          5.191000   0.000000   5.191000 (  5.190000)</diff>
      <filename>benchmark/contextr/bench.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,7 +40,7 @@ module ContextR
     
     instance_methods.each { |m| hide(m) }
 
-    def method_missing(method_name, *rest_args, &amp;block)
+    def method_missing(method_name, *rest_args)
       yield(:next, *rest_args)
     end
   end</diff>
      <filename>lib/contextr/inner_class.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,8 @@
 module ContextR #:nodoc:
   module VERSION #:nodoc:
     MAJOR = 0
-    MINOR = 2
-    TINY  = 0
+    MINOR = 1
+    TINY  = 9
 
     STRING = [MAJOR, MINOR, TINY].join('.')
   end</diff>
      <filename>lib/contextr/version.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,108 @@
+gem &quot;literate_maruku&quot;
 require &quot;literate_maruku&quot;
+require 'markaby'
+require 'active_support'
+
+class Fixnum
+  def ordinal
+    # teens
+    return 'th' if (10..19).include?(self % 100)
+    # others
+    case self % 10
+    when 1: return 'st'
+    when 2: return 'nd'
+    when 3: return 'rd'
+    else    return 'th'
+    end
+  end
+end
+
+class Time
+  def pretty
+    return &quot;#{mday}#{mday.ordinal} #{strftime('%B')} #{year}&quot;
+  end
+end
 
 module LiterateMarukuTest
   BASE_DIR = File.dirname(__FILE__) + &quot;/../&quot;
   TARGET_DIR = File.dirname(__FILE__) + &quot;/../../website/test/&quot;
 
   def self.load(file)
-    LiterateMaruku.require(BASE_DIR + &quot;#{File.basename(file, '.rb')}.mkd&quot;, 
-                           :output =&gt; TARGET_DIR,
-                           :attributes =&gt; {:execute =&gt; true})
+    content = LiterateMaruku.require(
+                               BASE_DIR + &quot;#{File.basename(file, '.rb')}.mkd&quot;, 
+                               :inline =&gt; true,
+                               :attributes =&gt; {:execute =&gt; true})
+
+    download = &quot;http://rubyforge.org/projects/contextr&quot;
+    version = ContextR::VERSION::STRING 
+    modified = Time.now 
+    sub_title = File.basename(file, '.rb').gsub(&quot;test_&quot;, &quot;&quot;).titleize
+    
+    doc = Markaby::Builder.new.xhtml_strict do
+      head do
+        title &quot;ContextR - #{sub_title} - Documentation&quot;
+        link :href =&gt; &quot;../stylesheets/screen.css&quot;, :rel=&gt;'stylesheet', 
+             :type=&gt;'text/css', :media =&gt; &quot;screen&quot;
+        script :src =&gt; &quot;../javascripts/rounded_corners_lite.inc.js&quot;,
+              :type =&gt;&quot;text/javascript&quot;
+        script %Q{
+          window.onload = function() {
+            settings = {
+                tl: { radius: 10 },
+                tr: { radius: 10 },
+                bl: { radius: 10 },
+                br: { radius: 10 },
+                antiAlias: true,
+                autoPad: true,
+                validTags: [&quot;div&quot;]
+            }
+            var versionBox = new curvyCorners(settings, 
+                                              document.getElementById(&quot;version&quot;));
+            versionBox.applyCornersToAll();
+          }
+        }, :type =&gt; &quot;text/javascript&quot;
+      end
+      body do
+        div.main! do
+          h1 sub_title 
+          div.version! :class =&gt; &quot;clickable&quot;,
+               :onclick =&gt; &quot;document.location='#{download}'; return false&quot; do
+            p &quot;Get Version&quot;
+            a version, :href =&gt; download, :class =&gt; &quot;numbers&quot;
+          end
+          h1 do
+            self &lt;&lt; &quot;&amp;#x2192; &amp;#8216;&quot;
+            a &quot;contextr&quot;, :href =&gt; &quot;http://contextr.rubyforge.org/&quot;
+            self &lt;&lt; &quot;&amp;#8217;&quot; 
+          end
+
+          ul.navi! do
+            Dir[File.dirname(file) + &quot;/test_*.mkd&quot;].each do |mkd_file_name|
+              li do
+                name = File.basename(mkd_file_name, &quot;.mkd&quot;).gsub(&quot;test_&quot;, &quot;&quot;)
+                a name.titleize, :href =&gt; name + &quot;.html&quot; 
+              end
+            end
+          end
+
+          self &lt;&lt; content
+          p.coda do
+            text modified.pretty
+            br
+            text &quot;Theme extended from &quot;
+            a &quot;Paul Battley&quot;, :href =&gt; &quot;http://rb2js.rubyforge.org/&quot;
+          end
+        end
+      end
+    end
+    File.open(TARGET_DIR + 
+            &quot;#{File.basename(file, '.rb').gsub(&quot;test_&quot;, &quot;&quot;)}.html&quot;, &quot;w&quot;) do |f|
+      f.puts(%q{&lt;!DOCTYPE html
+          PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
+              &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;})
+      doc.to_s.each do |chunk|
+        f.puts(chunk)
+      end
+    end
   end
 end</diff>
      <filename>test/lib/literate_maruku_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,6 @@ I tried to improve it by defining a little helper method called `step`. It shall
 test if all chunks are executed in the expected order and additionally check
 if the expected layers are activated. 
 
-    def step(index, *layers)
-      $step ||= 0
-      assert_equal(index, $step += 1)
-      assert_equal(layers, ContextR::active_layers)
-    end
 
 Layer activation shall be dynamically scoped. This is basically no problem, but
 it gets messy when doing thread programming and switching between scopes. The
@@ -23,31 +18,43 @@ As you may see, leaving the inner block in step 5 results in the &quot;lost&quot; layer
 the rest is support code.
 
     example do
+      def step(index, *layers)
+        @step ||= 0
+        assert_equal(index, @step += 1) if index
+        assert_equal(layers, ContextR::active_layers)
+      end
+
       mutex = Mutex.new
 
+      one_block = lambda do
+        mutex.lock
+        ContextR::with_layer :b do
+          step(3, :a, :b)
+          mutex.unlock
+          sleep(0.1)
+          mutex.lock
+          step(5, :a, :b)
+        end
+      end
+
+      two_block = lambda do
+        mutex.lock
+        step(4, :a)
+        mutex.unlock
+      end
+
       step(1)
       ContextR::with_layer :a do
         step(2, :a)
 
-        a = Thread.new do
-          mutex.lock
-          ContextR::with_layer :b do
-            step(3, :a, :b)
-            mutex.unlock
-            sleep(0.1)
-            mutex.lock
-            step(5, :a, :b)
-          end
-        end
+        one = Thread.new(&amp;one_block) 
+        two = Thread.new(&amp;two_block)
+        
+        step(nil, :a)
 
-        b = Thread.new do
-          mutex.lock
-          step(4, :a)
-          mutex.unlock
-        end
+        one.join
+        two.join
 
-        a.join
-        b.join
         step(6, :a)
       end
       step(7)</diff>
      <filename>test/test_dynamic_scope.mkd</filename>
    </modified>
    <modified>
      <diff>@@ -29,10 +29,10 @@ This could mean print the university a student belongs to or attach the
 address to the output.
 
 Additonal methods
-=================
+-----------------
 
 In a plain old Ruby project, this would result in additional methods, 
-propably encapsulated in modules, that will be included into our classes. 
+probably encapsulated in modules, that will be included into our classes. 
 This allows reuse and better encapsulation.
 
     module AddressOutput
@@ -59,8 +59,8 @@ instead of to\_s if you would like to have additional information.
       end
     end
 
-The same for each student. #to\_s\_with\_unversity and 
-#to\_s\_with\_university\_and\_address give as well additional output.
+The same for each student. #to\_s\_with\_unversity
+and #to\_s\_with\_university\_and\_address give as well additional output.
 
 So how can you use it. Let's create some instances first.
 
@@ -69,13 +69,13 @@ So how can you use it. Let's create some instances first.
 
 An now some output. 
 
-**Note**: This could live inside an erb template, a graphical 
-ui or printed to the command line. In all these cases to\_s is called 
-automatically by the standard libary to receive a good representation of 
+**Note**: This could live inside an erb template, a graphical user 
+interface or printed to the command line. In all these cases to\_s is called 
+automatically by the standard library to receive a good representation of 
 the object.       
 The output method defined in test\_helper.rb simulates this behaviour. All
 examples are converted to test class automatically, so we can be sure, that
-this document stays in sync with the libary.
+this document stays in sync with the library.
 
    puts $gregor   # =&gt; prints &quot;Gregor&quot;
    &quot;#{$gregor}&quot;   # =&gt; evaluates to &quot;Gregor&quot;
@@ -92,14 +92,14 @@ Assume, we would like to print an address list now.
       output_of($gregor.to_s_with_address) == &quot;Gregor (Berlin)&quot;
     end
 
-If you want a list with university and addresses, you would use 
-#to\_s\_with\_university\_and\_address. No automatic call to to\_s anymore. If 
-you have your layout in an erb template, you have to change each and every 
+If you want a list with university and addresses, you would 
+use #to\_s\_with\_university\_and\_address. No automatic call to to\_s anymore.
+If you have your layout in an erb template, you have to change each and every 
 occurrence of your variables.
 
 
 Redefining to\_s
-===============
+---------------
 
 To solve this problem you could redefine to\_s on demand. I will demonstrate
 this with some meta programming in a fresh class.
@@ -180,7 +180,7 @@ thread safe solution.
 
 
 ContextR
-========
+--------
 
 This is were context-oriented programming comes into play. I will again 
 start from the scratch. It is not much and we all know the problem space 
@@ -311,7 +311,11 @@ deactivate layers again.
       end
     end
 
-These encaspulations may be as complex as your application. ContextR will
+    example do
+      assert_equal([&quot;to_s&quot;], Religion.in_layer(:location).instance_methods)
+    end
+
+These encapsulations may be as complex as your application. ContextR will
 keep track of all activations and deactivations within the blocks and
 restore the settings after the block was executed.
 </diff>
      <filename>test/test_introduction.mkd</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ this behaviour. Therefore I will use foo bar code. But I think it is still
 easy to get the message.
 
 I. Multiple active layers
-=========================
+-------------------------
 
 Define the basis first.
 
@@ -101,7 +101,7 @@ activation is hidden, but is restored again after leaving the block.
 
 
 II. Multiple modules per layer and class
-========================================
+----------------------------------------
 
 It is also possible to have more than one module define the context-dependent
 behaviour of a class. In this case it may also happen, that multiple modules
@@ -130,7 +130,7 @@ we include them into the same layer and see what happens.
 This time the last inclusion defines the outermost method. But this is just Ruby's way of (multiple) inheritance and not part of ContextR. For the same reason a second inclusion of `FooMethod`s will not update the execution order.
 
 III. Conclusion
-===============
+---------------
 
 These should be all case where ordering matters. If you are aware of the
 two basic rules, everything should work as expected. </diff>
      <filename>test/test_ordering.mkd</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/test_yield_next.mkd</filename>
    </removed>
    <removed>
      <filename>test/test_yield_next.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>ca1977aaa3806dab1433669ef52370487a7414fe</id>
    </parent>
  </parents>
  <author>
    <name>schmidt</name>
    <email>schmidt@b232672f-569e-4225-9534-19f781cde581</email>
  </author>
  <url>http://github.com/schmidt/contextr/commit/eff7896d6ea0bf9d0a3f76008482b2f9debf6725</url>
  <id>eff7896d6ea0bf9d0a3f76008482b2f9debf6725</id>
  <committed-date>2007-11-30T01:53:00-08:00</committed-date>
  <authored-date>2007-11-30T01:53:00-08:00</authored-date>
  <message> * Updated test
   * removed yield next test - this was obsolete
   * fixed bugs in markdown syntax
   * added test for meta api
   * fixed problems in thread scope test
   * Literate Maruku HTML files have a layout now
 * Version No 0.1.9 - a 0.2.0 preview release
 * updated manifest
 * let inner_class catch fetch method with blocks as well
 


git-svn-id: svn+ssh://rubyforge.org/var/svn/contextr/trunk@76 b232672f-569e-4225-9534-19f781cde581</message>
  <tree>6053ae8ccf4f2d5deb37aca23fc3a5cb805b650e</tree>
  <committer>
    <name>schmidt</name>
    <email>schmidt@b232672f-569e-4225-9534-19f781cde581</email>
  </committer>
</commit>
