Created
November 19, 2012 00:55
-
-
Save swarley/4108401 to your computer and use it in GitHub Desktop.
pry/pry-hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[1] pry(main)> load "./hack.rb"; Pry.config.hack.enabled = true | |
=> true | |
[2] pry(main)> Pry.add_hack(:%, :symbol_array, Pry::Hackage::ModOpHack.new('S') { replace_with "%w#{capture 1}#{capture 2}#{capture 3}.map(&:to_sym)" }) | |
=> #<Pry::Hackage::ModOpHack:0x00000001081140 | |
@CHAR="S", | |
@CODE=#<Proc:0x00000001088f80@(pry):2>> | |
[3] pry(main)> %S{hello symbol world! i bet everyone is jealous of pry now} | |
=> [:hello, :symbol, :world!, :i, :bet, :everyone, :is, :jealous, :of, :p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment