Skip to content

Instantly share code, notes, and snippets.

@pragdave
Created February 19, 2013 00:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pragdave/4981930 to your computer and use it in GitHub Desktop.
Save pragdave/4981930 to your computer and use it in GitHub Desktop.
The Ruby 2 prepend() method makes method chaining a lot easier.
module SystemHook
private
def system(*args)
super.tap do |result|
puts "system(#{args.join(', ')}) returned #{result.inspect}"
end
end
end
class Object
prepend SystemHook
end
system("date")
system("kangaroo", "-hop 10", "skippy")
@dmitry
Copy link

dmitry commented Feb 28, 2013

Is there are any ability to access an old system method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment