Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed parsing bug when using file methods

  • Loading branch information...
commit d168218a39c85380d57886735deb4639e86b3318 1 parent cfd6db2
Ian Ownbey authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/parsing.rb
View
14 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
Please sign in to comment.
Something went wrong with that request. Please try again.