The simplest application is that you can use it to overwrite class behavior on a specific object.
def instance_of_object.method
end
What else? It might look like this:
class << instance_of_object
def method
end
end
This has been described as an essential technique for metaprogramming, but the low hanging fruit is very basic. If you want an object that doesn't necessarily tow the line according to it's class, use one of these.
Hard stuff list:
-
-
-
-
-
-
-Method Missing
No comments:
Post a Comment