Blog
An exploration of the art and
craft of software development
Object methods
Posted by Marty Haught on Sunday, August 06, 2006auth.methods
Which yields this:
=> ["[]=", "inspect", "send", "a=", "clone", "public_methods", "__send__", "pretty_print", "equal?", "freeze", "to_yaml_style", "__xmlele", "methods", "instance_eval", "dup", "instance_variables", "extend", "instance_of?", "__add_xmlele_value", "eql?", "to_yaml_properties", "hash", "id", "singleton_methods", "taint", "pretty_print_inspect", "lifetime", "frozen?", "instance_variable_get", "kind_of?", "to_a", "sessionId", "lifetime=", "display", "taguri", "type", "protected_methods", "sessionId=", "method", "==", "taguri=", "===", "instance_variable_set", "is_a?", "to_yaml", "respond_to?", "to_s", "authToken", "pretty_print_instance_variables", "class", "dclone", "tainted?", "=~", "private_methods", "authToken=", "__xmlattr", "__id__", "pretty_print_cycle", "nil?", "untaint", "object_id", "a", "[]"]
Useful but a bit cluttered. Instead you can do this:
auth.methods - Object.methods
=> ["[]=", "a=", "__xmlele", "__add_xmlele_value", "lifetime", "sessionId", "lifetime=", "sessionId=", "authToken", "authToken=", "__xmlattr", "a", "[]"]
Much nicer eh? It strips off all the Object class methods that are present on all objects. In this case I've learned that my new AuthResponse indeed has the sessionId, authToken attributes, which was what I was looking for.
blog comments powered by Disqus