Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Forward all methods to delayed log

  • Loading branch information...
commit 23e72d4cc8d879e4d3facac31f96643da48a8a27 1 parent 6be6fae
Joshua Peek josh authored
Showing with 8 additions and 6 deletions.
  1. +8 −6 actionpack/lib/abstract_controller/logger.rb
14 actionpack/lib/abstract_controller/logger.rb
View
@@ -11,15 +11,17 @@ module Logger
# just discard the String if the log level is too low.
#
# TODO: Require that Rails loggers accept a block.
- class DelayedLog
- def initialize(&blk)
- @blk = blk
+ class DelayedLog < ActiveSupport::BasicObject
+ def initialize(&block)
+ @str, @block = nil, block
end
- def to_s
- @blk.call
+ def method_missing(*args, &block)
+ unless @str
+ @str, @block = @block.call, nil
+ end
+ @str.send(*args, &block)
end
- alias to_str to_s
end
included do
Please sign in to comment.
Something went wrong with that request. Please try again.