So development on
PeerTAB is rolling along. Sort of. I am continuing to play with JXTA via JRuby.
So in Javamanager = new NetworkManager(NetworkManager.ConfigMode.EDGE, "HelloWorld");But of course in JRubyinclude_class "net.jxta.platform.NetworkManager"m = NetworkManager.new(NetworkManager.ConfigMode.EDGE, "HelloWorld")fails with
irb(main):010:0> NetworkManager.ConfigModeNoMethodError: undefined method `ConfigMode' for Java::NetJxtaPlatform::NetworkManager:Class from (irb):10:in `binding' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:150:in `eval_input' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `signal_status' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:147:in `eval_input' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `each_top_level_statement' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `loop' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `catch' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:146:in `eval_input' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:70:in `start' from :1:in `catch' from /home/jxta/jruby-1.0.1/lib/ruby/1.8/irb.rb:69:in `start' from :1So the question then I how do I get these
enum constants?So interestingly enough
irb(main):020:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):021:0>
But that did get me anywhere and it was only until I ran across
this blog post that I figured it out.
irb(main):011:0> NetworkManager::ConfigMode
=> Java::NetJxtaPlatform::NetworkManager::ConfigMode
irb(main):012:0> NetworkManager.constants
=> ["ConfigMode"]
irb(main):013:0> NetworkManager.constants.class
=> Array
irb(main):014:0> NetworkManager::ConfigMode::EDGE
=> #
irb(main):015:0>
And I know part of the problem is I refuse to use :: unless I'm forced to because it seems way too Perl-ish and ugly. And yeah, I've heard there is something called C++.