class Object
Constants
- Daff
Public Class Methods
new(target)
click to toggle source
# File lib/daff.rb, line 131 def initialize(target) @hx_exception_target = target; end
Public Instance Methods
_hx_add(x,y)
click to toggle source
# 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)
click to toggle source
# File lib/daff.rb, line 125 def _hx_ord(s) return 0 if s.nil?; s.ord end
_hx_str(x)
click to toggle source
# File lib/daff.rb, line 123 def _hx_str(x) (x.nil? ? 'null' : x.to_s) end
_hx_ushr(x,ct)
click to toggle source
# File lib/daff.rb, line 122 def _hx_ushr(x,ct) (((x<0) ? (x + 0x100000000) : x) >> ct) end
haxe_me(source_name)
click to toggle source
# 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?(0.class) 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?(0.class) 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)
click to toggle source
# 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)
click to toggle source
# File lib/daff.rb, line 134 def hx_raise(x) hx_exception_class(x.class).new(x) end
hx_rescue(x)
click to toggle source
# File lib/daff.rb, line 137 def hx_rescue(x) hx_exception_class(x.class) end
hx_rescued(x)
click to toggle source
# File lib/daff.rb, line 140 def hx_rescued(x) return x.hx_exception_target if x.respond_to? :hx_exception_target x end