Aptana 3 ruby debugger - Exception in DebugThread loop: undefined method `is_binary_data?'

后端 未结 3 1243
情歌与酒
情歌与酒 2020-12-29 00:45

I\'m trying to debug simple ruby file in Aptana 3.

class HelloWorld
  
def initialize()
    
end
  
def greet()
  puts "hello world"
end
end

h=Hell         


        
3条回答
  •  滥情空心
    2020-12-29 01:26

    My ruby version:

    ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
    

    My gems list:

    ...
    linecache19 (0.5.13)
    ruby-debug-base19 (0.11.26)
    ruby-debug-ide19 (0.4.12)
    ...
    

    In Aptana 3, I got same error.

    Exception in DebugThread loop: undefined method `is_binary_data?' for "#":String
    

    See ruby-debug-ide19-0.4.12 / xml_printer.rb .

      value_str = "[Binary Data]" if value_str.is_binary_data?
      print("",
          CGI.escapeHTML(name), kind, CGI.escapeHTML(value_str), value.class,
          has_children, value.respond_to?(:object_id) ? value.object_id : value.id)
    

    See http://apidock.com/ruby/String/is_binary_data%3F .

    String#is_binary_data?

    This method is deprecated or moved on the latest stable version. The last existing version (v1_9_1_378) is shown here.

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

    Add this code to xml_printer.rb (or to your code).

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

    Thank you.

提交回复
热议问题