75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'opal/stdlib/native.rb', line 75
def alias_native(new, old = new, options = {})
if old.end_with? ?=
define_method new do |value|
`#@native[#{old[0 .. -2]}] = #{Native.convert(value)}`
value
end
else
if as = options[:as]
define_method new do |*args, &block|
if value = Native.call(@native, old, *args, &block)
as.new(value.to_n)
end
end
else
define_method new do |*args, &block|
Native.call(@native, old, *args, &block)
end
end
end
end
|