Skip to content

Commit

Permalink
Fixed parsing bug when using file methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Ownbey committed Jul 23, 2008
1 parent cfd6db2 commit d168218
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/parsing.rb
Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d168218

Please sign in to comment.