Skip to content

Commit

Permalink
Do not modify string anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Mar 20, 2024
1 parent 8b37fdb commit 4d1870e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/irb/cmd/pa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ module ExtendCommand
class Pa < Nop
def execute(expression)
# The implementation basically taken from https://github.com/yui-knk/pry-power_assert/blob/2d10ee3df8efaf9c448f31d51bff8033a1792739/lib/pry-power_assert.rb#L26-L35, thank you!
result = +'result: '
result = ['result: ']

::PowerAssert.start(expression, source_binding: irb_context.workspace.binding) do |pa|
result << pa.yield.inspect << "\n\n"
result << pa.yield.inspect
result << "\n\n"
result << pa.message_proc.call
end

puts result
puts result.join
end
end
end
Expand Down

0 comments on commit 4d1870e

Please sign in to comment.