Aptana 3 ruby​​调试器 - DebugThread循环中的异常:未定义的方法`is_binary_data?'

bod*_*odo 6 ruby ruby-debug aptana3

我正在尝试在Aptana 3中调试简单的ruby文件.

class HelloWorld

def initialize()

end

def greet()
  puts "hello world"
end
end

h=HelloWorld.new
h.greet
Run Code Online (Sandbox Code Playgroud)

断点设置为

h.greet
Run Code Online (Sandbox Code Playgroud)

在我开始调试之后,调试器启动,但是当它尝试初始化ruby类时,调试器与消息断开连接

Fast Debugger (ruby-debug-ide 0.4.9) listens on :54749
Exception in DebugThread loop: undefined method `is_binary_data?' for "#<HelloWorld:0x85915fc>":String  
Run Code Online (Sandbox Code Playgroud)

当我设置断点时

h=HelloWorld.new
Run Code Online (Sandbox Code Playgroud)

调试器启动,但在我进入initialize()构造函数后,它与先前的消息断开连接

我的宝石列表:

*** LOCAL GEMS ***

archive-tar-minitar (0.5.2)
bigdecimal (1.1.0)
columnize (0.3.6)
io-console (0.3)
json (1.5.4)
linecache19 (0.5.13)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.4)
ruby-debug-base19 (0.11.26)
ruby-debug-ide19 (0.4.12)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5)
Run Code Online (Sandbox Code Playgroud)

我已成功应用这些指令,以解决调试问题,但我仍然收到此异常消息

任何答案都是受欢迎的,这可以解决这个问题.

谢谢.

小智 16

我的红宝石版本:

ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
Run Code Online (Sandbox Code Playgroud)

我的宝石列表:

...
linecache19 (0.5.13)
ruby-debug-base19 (0.11.26)
ruby-debug-ide19 (0.4.12)
...
Run Code Online (Sandbox Code Playgroud)

在Aptana 3中,我得到了同样的错误.

Exception in DebugThread loop: undefined method `is_binary_data?' for "#<PostsController:0x65a8da8>":String
Run Code Online (Sandbox Code Playgroud)

请参阅ruby-debug-ide19-0.4.12/xml_printer.rb.

  value_str = "[Binary Data]" if value_str.is_binary_data?
  print("<variable name=\"%s\" kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\"/>",
      CGI.escapeHTML(name), kind, CGI.escapeHTML(value_str), value.class,
      has_children, value.respond_to?(:object_id) ? value.object_id : value.id)
Run Code Online (Sandbox Code Playgroud)

请参见http://apidock.com/ruby/String/is_binary_data%3F.

串#is_binary_data?

不推荐使用此方法或在最新的稳定版本上移动此方法.此处显示最后一个现有版本(v1_9_1_378).

 def is_binary_data?
   ( self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" ) ) unless empty?
 end
Run Code Online (Sandbox Code Playgroud)

将此代码添加到xml_printer.rb(或您的代码).

class String
  def is_binary_data?
    ( self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" ) ) unless empty?
  end
end
Run Code Online (Sandbox Code Playgroud)

谢谢.