1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Merge pull request #18 from helsus/patch-1

fix from_environment
This commit is contained in:
Rafael Mendonça França 2015-04-09 12:35:05 -03:00
commit 03dea19aa0

View file

@ -55,15 +55,11 @@ module ExecJS
def self.from_environment def self.from_environment
if name = ENV["EXECJS_RUNTIME"] if name = ENV["EXECJS_RUNTIME"]
if runtime = const_get(name) raise RuntimeUnavailable, "#{name} runtime is not defined" unless const_defined?(name)
if runtime.available? runtime = const_get(name)
runtime if runtime.available?
else raise RuntimeUnavailable, "#{runtime.name} runtime is not available on this system" unless runtime.available?
raise RuntimeUnavailable, "#{runtime.name} runtime is not available on this system" runtime
end
elsif !name.empty?
raise RuntimeUnavailable, "#{name} runtime is not defined"
end
end end
end end