Class: Sol::RBObject

Inherits:
Object
  • Object
show all
Defined in:
lib/jx/rbobject.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jsvalue, ruby_obj, native) ⇒ RBObject





40
41
42
43
44
# File 'lib/jx/rbobject.rb', line 40

def initialize(jsvalue, ruby_obj, native)
  @jsvalue = jsvalue
  @ruby_obj = ruby_obj
  @native = native
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args, &blk) ⇒ Object





58
59
60
61
62
63
64
65
66
# File 'lib/jx/rbobject.rb', line 58

def method_missing(symbol, *args, &blk)

  begin
    @ruby_obj.send(symbol, *args, &blk)
  rescue TypeError
    args[0].native(symbol, @ruby_obj, &blk)
  end

end

Instance Attribute Details

#jsvalueObject (readonly)

Returns the value of attribute jsvalue.



32
33
34
# File 'lib/jx/rbobject.rb', line 32

def jsvalue
  @jsvalue
end

#native(*args) ⇒ Object (readonly)





72
73
74
# File 'lib/jx/rbobject.rb', line 72

def native
  @native
end

#ruby_objObject (readonly)

Returns the value of attribute ruby_obj.



33
34
35
# File 'lib/jx/rbobject.rb', line 33

def ruby_obj
  @ruby_obj
end

Instance Method Details

#typeofObject





50
51
52
# File 'lib/jx/rbobject.rb', line 50

def typeof
  B.push("object")
end