Permalink
Browse files

Merge radius threading fixes from trans

  • Loading branch information...
2 parents d2274c1 + 592e2ac commit 2b659ba524b747188fa912f9cd9ae5f1a6078788 @rtomayko committed May 28, 2010
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/tilt.rb
View
@@ -774,24 +774,25 @@ def initialize_engine
end
def prepare
- @context = Class.new(Radius::Context).new
end
def evaluate(scope, locals, &block)
- @context.define_tag("yield") do
+ context = Class.new(Radius::Context).new
+ context.define_tag("yield") do
block.call
end
- (class << @context; self; end).class_eval do
+ locals.each do |tag, value|
+ context.define_tag(tag) do
+ value
+ end
+ end
+ (class << context; self; end).class_eval do
define_method :tag_missing do |tag, attr, &block|
- if locals.key?(tag.to_sym)
- locals[tag.to_sym]
- else
- scope.__send__(tag) # any way to support attr as args?
- end
+ scope.__send__(tag) # any way to support attr as args?
end
end
options = {:tag_prefix => 'r'}.merge(@options)
- parser = Radius::Parser.new(@context, options)
+ parser = Radius::Parser.new(context, options)
parser.parse(data)
end
end

0 comments on commit 2b659ba

Please sign in to comment.