RubyMine Inspections modern Hash Syntax Fails Follow
The following is valid but fails the inspections in multiple ways wants to create methods out of the keys, complains about braces and commas...
myhash = {
prod: {
vision: 'http://visionjson.example.me',
xlink: 'http://xlinkweb.example.com/prod'
},
rel: {
vision: 'http://rel-visionjson.example.me',
xlink: 'http://dev.xlinkweb.example.com/rel'
},
qa: {
vision: 'http://qa-visionjson.example.me',
xlink: 'http://dev.xlinkweb.example.com/qa'
},
pre: {
vision: 'http://pre-visionjson.example.me',
xlink: 'http://dev.xlinkweb.example.com/pre'
},
sbx: {
vision: 'http://sbx-visionjson.example.me',
xlink: 'http://dev.xlinkweb.example.com/sbx'
}
}
Please sign in to leave a comment.
Hi,
I'd double-check that the project uses correct ruby sdk (often the problem caused by ruby 1.8 sdk which is set for the project)
Hope this helps, Oleg.
I'm also experiencing this problem, I had choose Ruby 2.0 (with rbenv) as the Project SDK
PS: The project language level is java 6 but I think it isn't related since it's not a java but ruby project. Am I wrong?
Hi,
I believe you are using Idea + Ruby plugin. Am I right?
If so what version of Idea/plugin are you using?
Also ruby sdk is set not to the project but to either JRuby facet or ruby module.
What kind of project and modules do you have?
Regards, Oleg.
It is a Java project with a single module. I have some ruby code there, with >1.9 syntax (like named captures and new hash style).
The IntelliJ IDEA version is the latest (14.0.3) and the plugin version is the latest too (7.0.0.2014.12.17).
PS: I've tried, using a Ruby project everything works fine.
Hi,
it is supposed to add JRuby facet to java module or have a separate ruby module.
In both cases you will be able to set ruby sdk.
Regards, Oleg.
Using the jRuby facet should work too (with ruby 1.9 syntax)?
yes, you just need to set ruby sdk for the facet
Regards, Oleg.
RUbyMIne is still showing (Red) syntax error in the editor. "Expecting =" I think your parsing for the old "Hash Rocket" style Ruby 2.x allows what I posted originally. I think also it is only complainin on nested hashes
myhash = {
value1: "some data",
nested: {
value2: "SOme nested element"
}
}
Regards
-dale
Oh also The new syntax is just like JS and JSON
Ah ok thanks :)
could you please show your project's settings (especially settings for jruby facet.
Regards, Oleg.
Having same problem here.
"Wrong Hash" inspection is complaingin about
insisting on HashRocket syntax.
Using Ruby 2.2.3 SDK in the project.
Just to clarify, complains about:
"data-selected-text-format": "count"
insists it should be
"data-selected-text-format" => "count"