2011-12-09 07:52:47 +01:00
|
|
|
|
|
|
|
module Rhino
|
|
|
|
|
2012-12-03 17:21:23 +01:00
|
|
|
@@stub_class = Class.new(Object) # :nodoc
|
2011-12-09 07:52:47 +01:00
|
|
|
|
2012-12-03 17:21:23 +01:00
|
|
|
def self.const_missing(name) # :nodoc
|
2011-12-09 07:52:47 +01:00
|
|
|
case name.to_s
|
|
|
|
when 'J' then
|
|
|
|
warn "[DEPRECATION] `Rhino::J` is deprecated, use `Rhino::JS` instead."
|
|
|
|
return JS
|
2011-12-09 11:28:27 +01:00
|
|
|
when 'JavascriptError' then
|
|
|
|
warn "[DEPRECATION] `Rhino::JavascriptError` is deprecated, use `Rhino::JSError` instead."
|
|
|
|
return JSError
|
2011-12-09 07:52:47 +01:00
|
|
|
when 'NativeObject' then
|
|
|
|
warn "[DEPRECATION] `Rhino::NativeObject` is no longer used, returning a stub."
|
|
|
|
return @@stub_class
|
|
|
|
when 'NativeFunction' then
|
|
|
|
warn "[DEPRECATION] `Rhino::NativeFunction` is no longer used, returning a stub."
|
|
|
|
return @@stub_class
|
|
|
|
else super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-03 17:21:23 +01:00
|
|
|
module To # :nodoc
|
2011-12-09 07:52:47 +01:00
|
|
|
|
|
|
|
extend self
|
|
|
|
|
2012-12-03 17:21:23 +01:00
|
|
|
# #deprecated use {Rhino#to_ruby} instead
|
2011-12-09 07:52:47 +01:00
|
|
|
def self.ruby(object)
|
2012-12-05 10:01:25 +01:00
|
|
|
warn "[DEPRECATION] `Rhino::To.ruby` is deprecated, use `Rhino.to_ruby` instead."
|
2011-12-09 07:52:47 +01:00
|
|
|
to_ruby(object)
|
|
|
|
end
|
|
|
|
|
2012-12-03 17:21:23 +01:00
|
|
|
# #deprecated use {Rhino#to_javascript} instead
|
2011-12-09 07:52:47 +01:00
|
|
|
def self.javascript(object, scope = nil)
|
2012-12-05 10:01:25 +01:00
|
|
|
warn "[DEPRECATION] `Rhino::To.javascript` is deprecated, use `Rhino.to_javascript` instead."
|
2011-12-09 07:52:47 +01:00
|
|
|
to_javascript(object, scope)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|