Sha256: 59a20025bfe9370b47c355b915b292c4216dab11908059a168b3a1140dc7258b
Contents?: true
Size: 1.24 KB
Versions: 9
Compression:
Stored size: 1.24 KB
Contents
module Wx class << self private class Key def initialize(mod, sym) @mod = mod @sym = sym end attr_reader :mod, :sym def eql?(other) self.class === other && mod == other.mod && sym == other.sym end def hash "#{mod}#{sym}".hash end end def delayed_constants @delayed_constants ||= ::Hash.new end public def add_delayed_constant(mod, sym, &block) delayed_constants[Key.new(mod,sym)] = block end def load_delayed_constants delayed_constants.each_pair { |key, blk| key.mod.const_set(key.sym, blk.call) } delayed_constants.clear # cleanup end def check_delayed_constant(mod, sym) if delayed_constants.has_key?(Key.new(mod, sym)) raise "Delayed constant #{mod.name}::#{sym} cannot be referenced before the Wx::App has started." end end end if !defined?(::WxGlobalConstants) def self.const_missing(sym) Wx.check_delayed_constant(self, sym) super end end end Dir.glob(File.join(File.dirname(__FILE__), 'ext', '*.rb')) do | fpath | require_relative './ext/' + File.basename(fpath) end # Constant extension loader for wxRuby3 # Copyright (c) M.J.N. Corino, The Netherlands
Version data entries
9 entries across 9 versions & 1 rubygems