2

I'm getting a lot of syntax errors:

SyntaxError: /Users/davidtuite/dev/ruby/seenbefore_client/spec/lib/url_group_spec.rb:40: syntax error, unexpected ':'

      records = stub(length: length)

yet the JRuby Blog says that "Compiler handles all 1.9 syntax now" since JRuby 1.6.0.rc2.

I'm using JRuby 1.6.5

rvm info
  ruby:
    interpreter:  "jruby"
    version:      "1.6.5"
    date:         "2011-10-25"
    platform:     "darwin-x86_64-java"
    patchlevel:   "TM"
    full_version: "jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]"
David Tuite
  • 22,258
  • 25
  • 106
  • 176
  • You must [use 1.9 mode](http://stackoverflow.com/questions/4755900/how-to-make-jruby-1-6-default-to-ruby-1-9). – yfeldblum Jan 29 '12 at 15:54

1 Answers1

3

JRuby can be made 1.9.2-compatible by adding the --1.9 command line switch or by adding that switch to the JRUBY_OPTS environment variable:

$ export JRUBY_OPTS='--1.9' 
$ bin/irb
irb(main):001:0> RUBY_VERSION
=> "1.9.2"
irb(main):002:0> {asd:3}
=> {:asd=>3}

Don't know how you can tell your RVM that, though. By the way, on Windows the batch syntax is set JRUBY_OPTS=--1.9.

Niklas B.
  • 92,950
  • 18
  • 194
  • 224