Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Fix therubyrhino deprecation warnings introduced between 1.73.0 and 1.73.1 #73

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions execjs.gemspec
Expand Up @@ -14,10 +14,13 @@ Gem::Specification.new do |s|
s.files = Dir["README.md", "LICENSE", "lib/**/*"]

s.add_dependency "multi_json", "~>1.0"
s.add_development_dependency "johnson"
s.add_development_dependency "mustang"

unless defined?(JRUBY_VERSION)
s.add_development_dependency "johnson"
s.add_development_dependency "mustang"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I can't pull any changes to the gemspec.

s.add_development_dependency "therubyracer"
end
s.add_development_dependency "rake"
s.add_development_dependency "therubyracer"
s.add_development_dependency "therubyrhino"

s.authors = ["Sam Stephenson", "Josh Peek"]
Expand Down
12 changes: 6 additions & 6 deletions lib/execjs/ruby_rhino_runtime.rb
Expand Up @@ -23,7 +23,7 @@ def eval(source, options = {})
if /\S/ =~ source
unbox @rhino_context.eval("(#{source})")
end
rescue ::Rhino::JavascriptError => e
rescue ::Rhino::JSError => e
if e.message == "syntax error"
raise RuntimeError, e.message
else
Expand All @@ -33,7 +33,7 @@ def eval(source, options = {})

def call(properties, *args)
unbox @rhino_context.eval(properties).call(*args)
rescue ::Rhino::JavascriptError => e
rescue ::Rhino::JSError => e
if e.message == "syntax error"
raise RuntimeError, e.message
else
Expand All @@ -42,13 +42,13 @@ def call(properties, *args)
end

def unbox(value)
case value = ::Rhino::To.ruby(value)
when ::Rhino::NativeFunction
case value = ::Rhino.to_ruby(value)
when ::Rhino::JS::BaseFunction
nil
when ::Rhino::NativeObject
when ::Rhino::JS::NativeObject
value.inject({}) do |vs, (k, v)|
case v
when ::Rhino::NativeFunction, ::Rhino::J::Function
when ::Rhino::JS::BaseFunction
nil
else
vs[k] = unbox(v)
Expand Down