Skip to content

Commit

Permalink
Merge 21b1215 into 69b6680
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Mar 14, 2021
2 parents 69b6680 + 21b1215 commit f181663
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def call_after_create
with_node type: 'sym', to_value: before_name do
if before_name.is_a?(Regexp)
node.to_value =~ before_name
if attributes.include?($1)
replace_with ":#{after_name.sub('{{attribute}}', $1)}"
if attributes.include?(Regexp.last_match(1))
replace_with ":#{after_name.sub('{{attribute}}', Regexp.last_match(1))}"
end
else
replace_with after_name
Expand All @@ -89,8 +89,8 @@ def call_after_create
with_node type: 'send', receiver: nil, message: before_name do
if before_name.is_a?(Regexp)
node.message.to_s =~ before_name
if attributes.include?($1)
replace_with after_name.sub('{{attribute}}', $1)
if attributes.include?(Regexp.last_match(1))
replace_with after_name.sub('{{attribute}}', Regexp.last_match(1))
end
else
replace_with after_name
Expand Down
4 changes: 2 additions & 2 deletions lib/ruby/new_2_2_hash_syntax.rb
Original file line number Diff line number Diff line change
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 f181663

Please sign in to comment.