0.01
A long-lived project that still receives updates
Use power_assert inspection in irb
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.13.0, < 2.0
>= 2.0.3, < 3.0
 Project Readme

irb-power_assert

Build Status Gem Version

Use power_assert inspection in irb

Usage

Tested only in ruby-head and the last 2 stable versions
So require Ruby 3.2 or higher

$ gem install irb-power_assert
...installed
$ irb -r irb-power_assert
# enabled this gem

Or specify in your ~/.irbrc as below

require 'irb/power_assert'
$ irb
irb(main):004> help pa
Print PowerAssert inspection for the given expression.

Then you can use pa as an IRB command.

irb(main):001:0> pa "0".class == "3".to_i.times.map {|i| i + 1 }.class
"0".class == "3".to_i.times.map {|i| i + 1 }.class
    |     |      |    |     |                |
    |     |      |    |     |                Array
    |     |      |    |     [1, 2, 3]
    |     |      |    #<Enumerator: ...>
    |     |      3
    |     false
    String

=> false

No hack is needed in your irbrc

Thanks!

ruby/power_assert is a recent my favorites.
(the author is @k-tsj, thank you!)

It is super helpful in complex testing.

I just would get irb version of yui-knk/pry-power_assert.

Latest IRB is much helpful to create own command

Honor should be bestowed upon them.

References