Module: Native
- Included in:
- Object
- Defined in:
- lib/opal/native.rb
Overview
–
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
++
Defined Under Namespace
Classes: Object
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(native) ⇒ Object
- #native_send(name, *args, &block) ⇒ Object (also: #__native_send__)
- #to_native ⇒ Object
Class Method Details
.===(other) ⇒ Object
12 13 14 |
# File 'lib/opal/native.rb', line 12 def self.=== (other) `#{other} == null || !#{other}.o$klass` end |
.included(klass) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/opal/native.rb', line 26 def self.included (klass) return super if klass.respond_to? :from_native class << klass def from_native (object) instance = allocate instance.instance_variable_set :@native, object instance end end end |
Instance Method Details
#initialize(native) ⇒ Object
39 40 41 |
# File 'lib/opal/native.rb', line 39 def initialize (native) @native = native end |
#native_send(name, *args, &block) ⇒ Object Also known as: __native_send__
47 48 49 50 51 52 53 |
# File 'lib/opal/native.rb', line 47 def native_send (name, *args, &block) unless Proc === `#@native[name]` raise NoMethodError, "undefined method `#{name}` for #{`#@native.toString()`}" end Native.send(@native, name, *args, &block) end |
#to_native ⇒ Object
43 44 45 |
# File 'lib/opal/native.rb', line 43 def to_native @native end |