Skip to content

Commit e532048

Browse files
committed
ScriptLanguageIndex: also index on language name
It is intuitive to be able to call scriptService.getLanguageByName(langName), where langName is what is given by ScriptLanguage#getLanguageName(). So we should index each ScriptLanguage not only by its short _engine_ names, but also by its _language_ name, which in some cases may actually be a different name than any of those used to refer to the engine itself. For example, the JRubyScriptEngine has "ruby" and "jruby" as its engine names, but "Ruby" as its language name.
1 parent 608ebcc commit e532048

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/org/scijava/script/ScriptLanguageIndex.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public boolean add(final ScriptEngineFactory factory, final boolean gently) {
8989
final ScriptLanguage language = wrap(factory);
9090

9191
// add language names
92+
byName.put(language.getLanguageName(), language);
9293
for (final String name : language.getNames()) {
9394
byName.put(name, language);
9495
}

0 commit comments

Comments
 (0)