Skip to content

Commit

Permalink
Assign nil to @index when fail to find suitable file to be patched
Browse files Browse the repository at this point in the history
  • Loading branch information
makicamel committed Oct 8, 2023
1 parent b882c91 commit 4f1e814
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/bulletmark_repairer/associations_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module BulletmarkRepairer
class AssociationsBuilder
def build(marker)
# TODO: Notify if fail to find suitable file to be patched
return if marker.index == ':' # viz marker.index is blank
return unless marker.index

if associations[marker.index]
associations[marker.index].add(marker)
Expand Down
4 changes: 2 additions & 2 deletions lib/bulletmark_repairer/markers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def set_up
@instance_variable_name = line&.scan(/\b?(@[\w]+)\b?/)&.flatten&.last
end
end
@index = view_yield_index.negative? ? ':' : "#{view_file}:#{view_yield_index}"
@index = view_yield_index.negative? ? nil : "#{view_file}:#{view_yield_index}"
else
# TODO: Ignore controllers list
# TODO: Allow directories list
Expand All @@ -90,7 +90,7 @@ def set_up
break if line.match?(/^\s+def [()\w\s=]+$/)
end
end
@index = @instance_variable_name ? "#{@file_name}:#{controller_yield_index}" : ':'
@index = @instance_variable_name ? "#{@file_name}:#{controller_yield_index}" : nil
end
end
end
Expand Down

0 comments on commit 4f1e814

Please sign in to comment.