public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Add support for argument capture and fix $DEBUG bootloader stuff [#390 
state:resolved]
Yehuda Katz (author)
Sat Jul 19 19:44:00 -0700 2008
commit  509851b02f2bcb7936f3a122b499e69253280ce5
tree    b39ac3003c130aacf1eab8fa38d585fdc3f01e84
parent  c019974cb103ca21722fe18c12872c50669a2ea3
...
60
61
62
 
63
64
 
 
 
65
 
 
 
66
67
68
...
60
61
62
63
64
 
65
66
67
68
69
70
71
72
73
74
0
@@ -60,9 +60,15 @@ module Merb
0
       def run
0
         subklasses = subclasses.dup
0
         until subclasses.empty?
0
+          time = Time.now.to_i
0
           bootloader = subclasses.shift
0
-          Merb.logger.debug!("Loading: #{bootloader}") if ENV['DEBUG']
0
+          if ENV['DEBUG'] && Merb.logger
0
+            Merb.logger.debug!("Loading: #{bootloader}")
0
+          end
0
           Object.full_const_get(bootloader).run
0
+          if ENV['DEBUG'] && Merb.logger
0
+            Merb.logger.debug!("It took: #{Time.now.to_i - time}")
0
+          end
0
           self.finished << bootloader
0
         end
0
         self.subclasses = subklasses
...
159
160
161
 
162
163
164
...
182
183
184
185
 
186
187
188
...
159
160
161
162
163
164
165
...
183
184
185
 
186
187
188
189
0
@@ -159,6 +159,7 @@ module Merb::Template
0
       template = ::Erubis::BlockAwareEruby.new(io.read)
0
 
0
       _old_verbose, $VERBOSE = $VERBOSE, nil
0
+      Merb.logger.fatal template.src
0
       template.def_method(mod, name, File.expand_path(io.path))
0
       $VERBOSE = _old_verbose
0
       
0
@@ -182,7 +183,7 @@ module Merb::Template
0
       #   <% end %>
0
       def capture_erb(*args, &block)
0
         _old_buf, @_erb_buf = @_erb_buf, ""
0
-        block.call
0
+        block.call(*args)
0
         ret = @_erb_buf
0
         @_erb_buf = _old_buf
0
         ret
...
15
16
17
 
 
 
18
19
20
...
15
16
17
18
19
20
21
22
23
0
@@ -15,6 +15,9 @@ module Merb::Test::Fixtures
0
     
0
     class Capture < HelperTesting
0
     end
0
+
0
+    class CaptureWithArgs < HelperTesting
0
+    end
0
     
0
     class CaptureEq < HelperTesting
0
       def helper_using_capture(&blk)
...
6
7
8
 
 
 
 
9
10
11
...
6
7
8
9
10
11
12
13
14
15
0
@@ -6,6 +6,10 @@ describe Merb::AbstractController, " with capture and concat" do
0
     dispatch_should_make_body("Capture", "Capture")    
0
   end
0
 
0
+  it "should support capture with arguments" do
0
+    dispatch_should_make_body("CaptureWithArgs", "Capture: one, two")
0
+  end  
0
+
0
   it "should support basic helpers that use capture with <%=" do
0
     dispatch_should_make_body("CaptureEq", "Pre. Beginning... Capturing... Done. Post.")
0
   end

Comments