lib/wunderbar/script.rb in wunderbar-1.0.21 vs lib/wunderbar/script.rb in wunderbar-1.0.23
- old
+ new
@@ -7,10 +7,11 @@
module Wunderbar
class ScriptNode
attr_accessor :block, :binding
def serialize(options, result, indent)
+ @block ||= nil
if @block and @children.empty? and not @text
width = options[:width]
width -= indent.to_s.length if width
@text = Ruby2JS.convert(@block, binding: @binding, width: width).to_s
end
@@ -43,11 +44,11 @@
Wunderbar.ruby2js(*args, &block)
end
end
def self.ruby2js(*args, &block)
- callback = Proc.new do |scope, args, block|
- ruby2js(scope, *args, &block)
+ callback = Proc.new do |scope, callback_args, callback_block|
+ ruby2js(scope, *callback_args, &callback_block)
end
@queue << [callback, args, block]
end
class CGI