Top Level Namespace
Defined Under Namespace
Modules: Coopy, Haxe, Rb, Sys, X_List
Classes: HxOverrides, HxSys, Lambda, List, Reflect, Std, StringBuf, Type, ValueType
Constant Summary
collapse
- Daff =
Coopy
Instance Method Summary
collapse
Instance Method Details
#_hx_add(x, y) ⇒ Object
124
|
# File 'lib/daff.rb', line 124
def _hx_add(x,y) (((x.is_a? String)||(y.is_a? String)) ? (_hx_str(x)+_hx_str(y)) : (x+y)) end
|
#_hx_ord(s) ⇒ Object
125
|
# File 'lib/daff.rb', line 125
def _hx_ord(s) return 0 if s.nil?; s.ord end
|
#_hx_str(x) ⇒ Object
123
|
# File 'lib/daff.rb', line 123
def _hx_str(x) (x.nil? ? 'null' : x.to_s) end
|
#_hx_ushr(x, ct) ⇒ Object
122
|
# File 'lib/daff.rb', line 122
def _hx_ushr(x,ct) (((x<0) ? (x + 0x100000000) : x) >> ct) end
|
#haxe_me(source_name) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/daff.rb', line 10
def haxe_me(source_name)
$hx_types ||= {}
$hx_types[source_name.join('.')] = self
_haxe_vars_ = {}
instance_methods(false).grep(/=$/).grep(/^[^\[=]/).each do |v|
_haxe_vars_[v.to_s[0..-2].to_sym] = ('@'+v.to_s[0..-2]).to_sym
end
old_get = instance_method(:[]) rescue nil
define_method(:[]) do |x|
return old_get.bind(self).(x) if x.is_a?(Integer)
tag = _haxe_vars_[x]
return instance_variable_get(tag) if tag
method x
end
old_set = instance_method(:[]=) rescue nil
define_method(:[]=) do |x,y|
return old_set.bind(self).(x,y) if x.is_a?(Integer)
instance_variable_set(_haxe_vars_[x],y)
end
define_method(:haxe_name) do
source_name.join('.')
end
class << self
define_method(:[]) do |x|
method x
end
end
end
|
#hx_exception_class(c) ⇒ Object
127
128
129
130
131
132
133
|
# File 'lib/daff.rb', line 127
def hx_exception_class(c)
$hx_exception_classes[c.name] ||= Class.new(RuntimeError) do
Object.const_set((c.name.split(/::/)[-1]||'') + 'HaxeException',self)
attr_accessor :hx_exception_target
def initialize(target) @hx_exception_target = target; end
end
end
|
#hx_raise(x) ⇒ Object
134
135
136
|
# File 'lib/daff.rb', line 134
def hx_raise(x)
hx_exception_class(x.class).new(x)
end
|
#hx_rescue(x) ⇒ Object
137
138
139
|
# File 'lib/daff.rb', line 137
def hx_rescue(x)
hx_exception_class(x.class)
end
|
#hx_rescued(x) ⇒ Object
140
141
142
143
|
# File 'lib/daff.rb', line 140
def hx_rescued(x)
return x.hx_exception_target if x.respond_to? :hx_exception_target
x
end
|