Skip to content

Commit

Permalink
fix: use tap with break instead of yield_self in Ruby 2.5 or `the…
Browse files Browse the repository at this point in the history
…n` in Ruby 2.6
  • Loading branch information
iberianpig committed Feb 7, 2024
1 parent 8ea4256 commit 28a3ea7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/active_hash/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def pluck(*column_names)
if column_names.length == 1
all.map(&column_names.first.to_sym)
else
column_names.map { |column_name| all.map(&column_name.to_sym) }.yield_self { |values| :zip.to_proc.(*values) }
# `tap with break` can be replaced with yield_self in Ruby 2.5 or then in Ruby 2.6
column_names.map { |column_name| all.map(&column_name.to_sym) }.tap { |values| break :zip.to_proc.(*values) }
end
end

Expand Down

0 comments on commit 28a3ea7

Please sign in to comment.