Skip to content

Commit

Permalink
Merge pull request #95 from mcorino/develop
Browse files Browse the repository at this point in the history
fix Windows platform issue
  • Loading branch information
mcorino committed Jun 22, 2023
2 parents ba98792 + a4d5479 commit 9f29d49
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
10 changes: 8 additions & 2 deletions lib/wx/accessors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ def method_missing(sym, *args)

def self.included(mod)
mod.extend WxRubyStyleAccessors
mod.constants.collect { | c | mod.const_get(c) }.grep(Module).each do |mod|
mod.include WxRubyStyleAccessors if mod.name.start_with?('Wx::') # only setup Wx namespace
org_verbose = $VERBOSE
begin
$VERBOSE = nil
mod.constants.collect { | c | mod.const_get(c) }.grep(Module).each do |mod|
mod.include WxRubyStyleAccessors if mod.name.start_with?('Wx::') # only setup Wx namespace
end
ensure
$VERBOSE = org_verbose
end
end
end
42 changes: 24 additions & 18 deletions lib/wx/global_const.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,30 @@ class << self
def search_nested(mod, sym, path = [])
# check any nested modules and/or (enum) classes
const_val = nil
mod.constants.each do |c|
case cv = mod.const_get(c)
when ::Class
if cv < Wx::Enum
# the only thing of interest in Enum classes are the enum values
const_val = cv[sym]
elsif cv.name.start_with?('Wx::') # only search Wx namespace
# prevent const_missing being triggered here since that may lead to unexpected results
const_val = cv.const_get(sym) if cv.constants.include?(sym)
const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
end
when ::Module
if cv.name.start_with?('Wx::') # only search Wx namespace
const_val = cv.const_get(sym) if cv.constants.include?(sym)
const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
end
end unless mod == cv # watch out for infinite recursion
break if const_val
org_verbose = $VERBOSE
begin
$VERBOSE = nil
mod.constants.each do |c|
case cv = mod.const_get(c)
when ::Class
if cv < Wx::Enum
# the only thing of interest in Enum classes are the enum values
const_val = cv[sym]
elsif cv.name.start_with?('Wx::') # only search Wx namespace
# prevent const_missing being triggered here since that may lead to unexpected results
const_val = cv.const_get(sym) if cv.constants.include?(sym)
const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
end
when ::Module
if cv.name.start_with?('Wx::') # only search Wx namespace
const_val = cv.const_get(sym) if cv.constants.include?(sym)
const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
end
end unless mod == cv # watch out for infinite recursion
break if const_val
end
ensure
$VERBOSE = org_verbose
end
const_val
end
Expand Down
2 changes: 1 addition & 1 deletion lib/wx/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Wx
WXRUBY_VERSION = '0.9.0-beta.13'
WXRUBY_VERSION = '0.9.0-beta.14'
end
2 changes: 1 addition & 1 deletion rakelib/lib/generate/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_constants_db
def handle_module(mod, table)
mod.constants.each do |c|
a_const = mod.const_get(c)
if ::Module === a_const || ::Class === a_const # Package submodule or Class (possibly Enum)
if (::Module === a_const || ::Class === a_const) && a_const.name.start_with?('Wx::') # Wx:: Package submodule or Class (possibly Enum)
handle_module(a_const, table[c.to_s] = {})
elsif Wx::Enum === a_const
table[c.to_s] = { type: a_const.class.name.split('::').last, value: "\#{a_const.class}.new(\#{a_const.to_i})" }
Expand Down

0 comments on commit 9f29d49

Please sign in to comment.