1

I installed rubeus using the command below:

jruby -S gem install rubeus
bundle install

Then when i execute:

include Rubeus::Swing

I get this error :

undefined method `to_a' for "include Rubeus::Swing\n":String

So I think gem installed the wrong version, because method to_a is no longer supported in Ruby 1.9.x for strings

How can I fix this?


code:

require 'rubygems'
require 'java'
require 'rubeus'

include Rubeus::Swing #it's where everything crashes :-)

UPDATE

It seems the problem is with the jirb, I saved the code in a file and ran the code with jruby, and everything went well... I'm confused, what's wrong with jirb?

aliep
  • 1,702
  • 2
  • 21
  • 33

1 Answers1

2

I'm not sure why, but I can confirm that Rubeus breaks jirb:

$ irb-jruby-1.7.3
irb(main):001:0> require 'rubeus'
=> true
irb(main):002:0> 1
NoMethodError: undefined method `to_a' for "1\n":String

Things do seem to work fine when non-interactively interpreting a script. One workaround is to simply add to_a back into String:

class String
  def to_a
    lines.to_a
  end
end
# => nil
require 'rubeus'
# => true
include Rubeus::Swing
# => Object

The only issue I've noticed so far is that require 'rubeus' still breaks jirb in a second way: I now need to press Enter twice for every input.

Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109