Skip to content

Commit

Permalink
Ensure namespace is always set when parent module is not found.
Browse files Browse the repository at this point in the history
Fixes #753
  • Loading branch information
lsegal committed Mar 22, 2014
1 parent 6cfa74e commit d420e94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/yard/handlers/c/handler_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module HandlerMethods

def handle_class(var_name, class_name, parent, in_module = nil)
parent = nil if parent == "0"
namespace = in_module ? namespace_for_variable(in_module) : Registry.root
namespace = namespace_for_variable(in_module) if in_module
namespace ||= Registry.root
register ClassObject.new(namespace, class_name) do |obj|
if parent
parent_class = namespace_for_variable(parent)
Expand All @@ -24,7 +25,8 @@ def handle_class(var_name, class_name, parent, in_module = nil)
end

def handle_module(var_name, module_name, in_module = nil)
namespace = in_module ? namespace_for_variable(in_module) : Registry.root
namespace = namespace_for_variable(in_module) if in_module
namespace ||= Registry.root
register ModuleObject.new(namespace, module_name) do |obj|
namespaces[var_name] = obj
register_file_info(obj, statement.file, statement.line)
Expand Down

0 comments on commit d420e94

Please sign in to comment.