Module: Rhino

Extended by:
To
Defined in:
lib/rhino.rb,
lib/rhino/ruby.rb,
lib/rhino/error.rb,
lib/rhino/context.rb,
lib/rhino/version.rb,
lib/rhino/wormhole.rb,
lib/rhino/ruby/access.rb,
lib/rhino/deprecations.rb,
lib/rhino/ruby/default_access.rb,
lib/rhino/ruby/attribute_access.rb

Defined Under Namespace

Modules: JS, Ruby, To Classes: Context, ContextError, IOReader, JSError, RestrictableContextFactory, RunawayScriptError, ScriptTimeoutError

Constant Summary collapse

RubyObject =
Ruby::Object
RubyFunction =
Ruby::Function
RubyConstructor =
Ruby::Constructor
ContextFactory =

:nodoc: backward compatibility

JS::ContextFactory
VERSION =
"1.73.3"
@@stub_class =
Class.new(Object)
@@warnings =
{}

Class Method Summary collapse

Methods included from To

args_to_javascript, args_to_ruby, javascript, ruby, to_javascript, to_ruby

Class Method Details

.const_missing(name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rhino/deprecations.rb', line 6

def self.const_missing(name)
  case name.to_s
  when 'J' then
    warn "[DEPRECATION] `Rhino::J` is deprecated, use `Rhino::JS` instead."
    return JS
  when 'JavascriptError' then
    warn "[DEPRECATION] `Rhino::JavascriptError` is deprecated, use `Rhino::JSError` instead."
    return JSError
  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

.warn(msg) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/rhino/deprecations.rb', line 26

def self.warn(msg)
  # only print out deprecation warnings once
  if msg[0, 13] == '[DEPRECATION]'
    return nil if @@warnings[msg]
    @@warnings[msg] = true
  end
  super # Kernel.warn
end