Skip to content

Commit

Permalink
Fix calling methods in namespace like YaPI::Network module and call t…
Browse files Browse the repository at this point in the history
…o YaPI::Error()

It is done via improving detection of already loaded modules, that it must have any reasonable method.
  • Loading branch information
jreidinger committed Jul 9, 2013
1 parent a692156 commit dd5395a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ruby/yast/yast.rb
Expand Up @@ -95,13 +95,20 @@ def self.import(mname)
base = tmp_m
end

# do not reimport if already imported
return if base.constants.include?(modules.last.to_sym)
# do not reimport if already imported and contain some methods
# ( in case namespace contain some methods )
if base.constants.include?(modules.last.to_sym) &&
!(base.const_get(modules.last).methods - Object.methods()).empty?
return
end

import_pure(mname)

# do not create wrapper if module is in ruby and define itself object
return if base.constants.include?(modules.last.to_sym)
if base.constants.include?(modules.last.to_sym) &&
!(base.const_get(modules.last).methods - Object.methods()).empty?
return
end

m = ::Module.new
symbols(mname).each do |sname,stype|
Expand Down

0 comments on commit dd5395a

Please sign in to comment.