|
|
|
|
|
by griffindy
4721 days ago
|
|
> What kind of creation are you building that you are expecting
> to not know which methods are available while running your program? `method_missing` is more useful for dynamically responding to method calls than actually not knowing how to respond. A good example of this is rails' (version 3.2 and lower) dynamic finders: User.find_by_username('a_username') `find_by_username` is never defined anywhere, it is dynamically responded to using method missing. this allows code to be much more precise and DRY (though at the expense of readability if you don't know what's going on) |
|