Guest User

IRB

a guest
Jan 6th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.78 KB | None | 0 0
  1. irb(main):003:0> quote_of_the_day = WikiQuote.get
  2. => "\n\n \n\n\n\nUntil we consider animal life to be worthy of the consideration and reverence we bestow upon old books and pictures and historic monuments, there will always be the animal refugee living a precarious life on the edge of extermination, dependent for existence on the charity of a few human beings.\n\n~ Gerald Durrell ~\n\n \n\n"
  3. irb(main):004:0> def author
  4. irb(main):005:1> quote_of_the_day[quote_of_the_day.rindex("~", quote_of_the_day.rindex("~") - 1)..quote_of_the_day.rindex("~")].gsub(/(^~\s*|\s*~$)/, "")
  5. irb(main):006:1> end
  6. => nil
  7. irb(main):007:0> author
  8. NameError: undefined local variable or method `quote_of_the_day' for main:Object
  9.     from (irb):5:in `author'
  10.     from (irb):7
  11.     from /usr/bin/irb:12:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment