Metaprogramming in Ruby



Exercise 3

There are lots of ways to define singleton method.

animal = 'dog'

# define singleton speak() method

animal.speak  #=> 'Dog says Woof!'

Write your codes and post them here. Let's discuss about them.

Hints: