CSC/ECE 517 Fall 2007/wiki1b 2 Method Missing: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
"There are plenty of examples of method_missing on the Web. Unfortunately, I find most of them rather difficult to understand. One needs to look at quite a bit of source code and figure out what it does. Fix this by giving a plain-English description of several uses of method_missing not covered in our class, with Web links to the pages where you found them." | "There are plenty of examples of method_missing on the Web. Unfortunately, I find most of them rather difficult to understand. One needs to look at quite a bit of source code and figure out what it does. Fix this by giving a plain-English description of several uses of method_missing not covered in our class, with Web links to the pages where you found them." | ||
== A world without "Method Missing" == | |||
== What is "Method Missing" and what the fuss is all about ??? == | == What is "Method Missing" and what the fuss is all about ??? == | ||
Line 11: | Line 12: | ||
== | == Provide Cool APIs with Method Missing! == | ||
@ http://ajax.stealthsettings.com/rubyisms-in-rails/metaprogramming/ | @ http://ajax.stealthsettings.com/rubyisms-in-rails/metaprogramming/ | ||
This section covers how we can use Method Missing to provide a very comprehensive list of API methods in a class, with a little amount of code. Lets assume that we are creating a flickr(www.flickr.com) search API class. What could be the interface of this class? Well basically, the purpose of this class would be to provide a variety of methods using which developers can search photos in flickr database. For example, the following methods could be provided in the Flickr Search API: | |||
Revision as of 17:28, 1 October 2007
"There are plenty of examples of method_missing on the Web. Unfortunately, I find most of them rather difficult to understand. One needs to look at quite a bit of source code and figure out what it does. Fix this by giving a plain-English description of several uses of method_missing not covered in our class, with Web links to the pages where you found them."
A world without "Method Missing"
What is "Method Missing" and what the fuss is all about ???
"Method Missing for Dummies" Example!
-> http://rubylearning.com/satishtalim/ruby_method_missing.html
Provide Cool APIs with Method Missing!
@ http://ajax.stealthsettings.com/rubyisms-in-rails/metaprogramming/
This section covers how we can use Method Missing to provide a very comprehensive list of API methods in a class, with a little amount of code. Lets assume that we are creating a flickr(www.flickr.com) search API class. What could be the interface of this class? Well basically, the purpose of this class would be to provide a variety of methods using which developers can search photos in flickr database. For example, the following methods could be provided in the Flickr Search API:
Creating Dynamic Methods on the Fly!
-> http://redhanded.hobix.com/inspect/hatchingNewMethodsInMidAir.html
Build your own DSL with Ruby!
-> http://liquiddevelopment.blogspot.com/2006/04/twisting-and-shaping-dsls-using-ruby.html , http://riffraff.blogsome.com/2006/05/02/metaprogramming-breakfast/