Advertisement
Guest User

Untitled

a guest
Jan 6th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.32 KB | None | 0 0
  1. class Plant
  2.     def initialize
  3.         @leaves = true
  4.         @requireNoms = true
  5.     end
  6.     def talk
  7.         puts "Feed me!"
  8.     end
  9. end
  10.  
  11. class Daisy < Plant
  12.     def
  13.         @noms = "Sunlight"
  14.     end
  15. end
  16.  
  17. class VenusFlyTrap < Plant
  18.     def
  19.         @noms = "Flies"
  20.     end
  21. end
  22.  
  23.  
  24.  
  25. In irb:
  26. âžœ  seperation git:(master) ✗ irb
  27. irb(main):001:0> class Plant
  28. irb(main):002:1> def initialize
  29. irb(main):003:2> @leaves = true
  30. irb(main):004:2> @requireNoms = true
  31. irb(main):005:2> end
  32. irb(main):006:1> def talk
  33. irb(main):007:2> puts "Feed me!"
  34. irb(main):008:2> end
  35. irb(main):009:1> end
  36. => :talk
  37. irb(main):010:0>
  38. irb(main):011:0* class Daisy < Plant
  39. irb(main):012:1> def
  40. irb(main):013:2* @noms = "Sunlight"
  41. irb(main):014:2> end
  42. irb(main):015:1> end
  43. SyntaxError: (irb):13: syntax error, unexpected '=', expecting :: or '.'
  44. @noms = "Sunlight"
  45.        ^
  46. (irb):15: syntax error, unexpected keyword_end, expecting end-of-input
  47.     from /usr/local/bin/irb:11:in `<main>'
  48. irb(main):016:0>
  49. irb(main):017:0* class VenusFlyTrap < Plant
  50. irb(main):018:1> def
  51. irb(main):019:2* @noms = "Flies"
  52. irb(main):020:2> end
  53. irb(main):021:1> end
  54. SyntaxError: (irb):19: syntax error, unexpected '=', expecting :: or '.'
  55. @noms = "Flies"
  56.       ^
  57. (irb):21: syntax error, unexpected keyword_end, expecting end-of-input
  58.     from /usr/local/bin/irb:11:in `<main>'
  59. irb(main):022:0>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement