daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Feb 21st, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. class Dog
  2.   attr_accessor :animal_type
  3.   %w(cats dogs rabbits pigs cows).each do |t|
  4.     define_method "has_#{t}" do |number|
  5.       @animal_type = t
  6.       puts number
  7.     end
  8.   end
  9. end
  10.  
  11. d = Dog.new
  12. d.has_dogs 10
  13. puts d.animal_type
  14. p d.methods.sort
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top