Persisting custom methods in ruby interpreter
To enhance your interpreter you may add some custom method or functions to your .irbrc
or .pryrc
files that usually can be found in your home directory ~/.irbrc
, ~/.pryrc
How example ~/.pryrc
file may look like:
def v_trace
caller.select { |x| x.include?(Rails.root.to_s) }
end
class Object
def m?(method_name)
self.methods.grep /#{method_name}/
end
end
After saving the above changes, run pry
command and take advantage of new features
NOTE:
Tweet