Advertisement
Guest User

Untitled

a guest
Mar 30th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.32 KB | None | 0 0
  1. class Notifier
  2.   @@prefixes = {
  3.       :done => "[+] ",
  4.       :note => "[!] ",
  5.       :error => "[-] ",
  6.   }
  7.  
  8.   def self.method_missing(method, *args)
  9.     puts "#{@@prefixes[method]} #{args}"
  10.   end
  11. end
  12.  
  13. # then you do like this all over the place
  14. Notifier.done "This thing was completed now."
  15. Notifier.error "ZOMG!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement