mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
commit
03dea19aa0
1 changed files with 5 additions and 9 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue