lib/jx/js.rb
#----------------------------------------------------------------------------------------
# Pack a ruby object for use inside a javascript script.  A packed ruby object is
# identical to a proxy object exect by the return value that is a java.JSValue and not
# a Sol::xxx object.
# @param obj [Object] The ruby object to be packed
# @return [java.JSObject] A java.JSObject that that implements the 'run' interface
#----------------------------------------------------------------------------------------
Pack a ruby object for use inside a javascript script.  A packed ruby object is
identical to a proxy object exect by the return value that is a java.JSValue and not
a Sol::xxx object.
Pack a ruby object for use inside a javascript script . A packed ruby object is identical to a proxy object exect by the return value that is a java . JSValue and not a Sol :: xxx object .
def pack(obj)
      case obj
      when TrueClass, FalseClass, Numeric, String, NilClass,
           Java::ComTeamdevJxbrowserChromium::JSValue
        obj
      when Proc
        blk2func(obj).jsvalue
      when Object
        assign_window("obj", Callback.build(obj))
        jeval("new RubyProxy(obj)")
      else
        raise "No method to pack the given object: #{obj}"
      end
    end
def pack ( obj ) case obj when TrueClass , FalseClass , Numeric , String , NilClass , Java :: ComTeamdevJxbrowserChromium :: JSValue obj when Proc blk2func ( obj ) . jsvalue when Object assign_window ( "obj" , Callback . build ( obj ) ) jeval ( "new RubyProxy(obj)" ) else raise "No method to pack the given object: #{obj}" end end
Pack a ruby object for use inside a javascript script.
Pack a ruby object for use inside a javascript script .
# B.obj = Callback.build(obj)
A java.JSObject that that implements the 'run' interface
A java . JSObject that that implements the ' run ' interface
java.JSObject
obj
The ruby object to be packed
The ruby object to be packed