mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
c05c8f31c1
Pry::CommandSet#[]= can be used to re-assign commands or add new ones to a command set. The key matches the pattern of a command you'd like to replace and the value is the command you'd the pattern to be matched with. The key is really important. You could say this: Pry.commands.command "hello" do output.puts "Hello! :)" end Pry.commands["help"] = Pry.commands["hello"] I would expect "help" to print "Hello! :)", but the command is bound to the pattern "hello". A new copy of the "hello" command is created and the key is used as the match pattern, so "help" will print "Hello! :)". You can use #[]= to replace commands, maybe your own 'help' implementation: Pry.commands["help"] = MyHelpCommand Commands can also be deleted by assigning a value of nil: Pry.commands["help"] = nil I decided to implement this based on SO post found here: http://stackoverflow.com/questions/17475829/configure-help-output-in-pry |
||
---|---|---|
.. | ||
pry | ||
pry.rb |