Skip to content

Commit

Permalink
Auto corrected by following Lint Ruby Style/PerlBackrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Awesome Code committed Apr 1, 2021
1 parent 2d95864 commit a5ca506
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/rails/convert_active_record_dirty_5_0_to_5_1.rb
Expand Up @@ -92,8 +92,8 @@ def call_after_create
# after_save :invalidate_cache, if: :status_changed?
with_node type: 'sym', to_value: before_name do
if before_name.is_a?(Regexp)
if node.to_value =~ before_name && attributes.include?($1)
replace_with ":#{after_name.sub('{{attribute}}', $1)}"
if node.to_value =~ before_name && attributes.include?(Regexp.last_match(1))
replace_with ":#{after_name.sub('{{attribute}}', Regexp.last_match(1))}"
end
else
replace_with after_name
Expand All @@ -111,8 +111,8 @@ def call_after_create
# end
with_node type: 'send', message: before_name do
if before_name.is_a?(Regexp)
if node.message.to_s =~ before_name && attributes.include?($1)
replace :message, with: after_name.sub('{{attribute}}', $1)
if node.message.to_s =~ before_name && attributes.include?(Regexp.last_match(1))
replace :message, with: after_name.sub('{{attribute}}', Regexp.last_match(1))
end
else
replace :message, with: after_name
Expand Down
4 changes: 2 additions & 2 deletions lib/ruby/new_2_2_hash_syntax.rb
Expand Up @@ -33,9 +33,9 @@
when :sym
case node.key.to_source
when /\A:"([^"'\\]*)"\z/
replace_with "'#{$1}': {{value}}"
replace_with "'#{Regexp.last_match(1)}': {{value}}"
when /\A:(.+)\z/
replace_with "#{$1}: {{value}}"
replace_with "#{Regexp.last_match(1)}: {{value}}"
end
when :dsym
if new_key = node.key.to_source[/\A:(.+)/, 1]
Expand Down

0 comments on commit a5ca506

Please sign in to comment.