Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dog
- attr_accessor :number_of_computers
- def method_missing(name, *args)
- name = name.to_s
- name =~ /has_(\d+)_computers/
- @number_of_computers = $1.to_i
- end
- end
- d = Dog.new
- d.has_20_computers
- puts d.number_of_computers
Add Comment
Please, Sign In to add comment