diff --git a/lib/parsing.rb b/lib/parsing.rb index 0b43e5a..0367023 100644 --- a/lib/parsing.rb +++ b/lib/parsing.rb @@ -209,8 +209,8 @@ def process_type_or_module(obj, parent) def process_method(obj, parent) if obj.is_alias_for.nil? @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) - p = CodeMethod.create(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => @current_container.id, :name => obj.name, :parameters => obj.params, :block_parameters => obj.block_params, :singleton => obj.singleton, :visibility => obj.visibility.to_s, :force_documentation => obj.force_documentation, :source_code => get_source_code(obj)) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) + p = CodeMethod.create(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.id, :name => obj.name, :parameters => obj.params, :block_parameters => obj.block_params, :singleton => obj.singleton, :visibility => obj.visibility.to_s, :force_documentation => obj.force_documentation, :source_code => get_source_code(obj)) comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank? @methods << p.id @comments << comment.id if comment @@ -221,7 +221,7 @@ def process_method(obj, parent) def process_alias(obj, parent, from_method = false) @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) if from_method p = CodeAlias.create({ :code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), @@ -242,7 +242,7 @@ def process_alias(obj, parent, from_method = false) def process_constant(obj, parent) @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) p = CodeConstant.create_or_update_by_name_and_code_container_id(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.try(:id), :name => obj.name, :value => obj.value) comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank? @objects << p.id @@ -251,7 +251,7 @@ def process_constant(obj, parent) def process_attribute(obj, parent) @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) p = CodeAttribute.create_or_update_by_name_and_code_container_id(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.try(:id), :name => obj.name, :read_write => obj.rw) comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank? @objects << p.id @@ -260,7 +260,7 @@ def process_attribute(obj, parent) def process_require(obj, parent) @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) p = CodeRequire.create_or_update_by_name_and_code_container_id(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.try(:id), :name => obj.name) comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank? @objects << p.id @@ -269,7 +269,7 @@ def process_require(obj, parent) def process_include(obj, parent) @first_comment ||= Digest::MD5.hexdigest(obj.comment) if obj.comment - parent = CodeContainer.find_by_full_name(parent.full_name) + parent = CodeContainer.find_by_full_name(parent.try(:full_name) || parent.file_absolute_name) p = CodeInclude.create_or_update_by_name_and_code_container_id(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.try(:id), :name => obj.name) comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank? @objects << p.id