Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize #instance_methods to automatically determine the last method defined #11

Open
ELLIOTTCABLE opened this issue Aug 8, 2009 · 0 comments

Comments

@ELLIOTTCABLE
Copy link
Owner

As another convenience, allow Speck.new to be called with no arguments directly after the definition of a method to attach it to that method.

Worth noting: Object#instance_methods seems to preserve the order in which methods were defined, to some extent:

(ancestors - [self]).inject(instance_methods) {|methods, ancestor| methods - ancestor.instance_methods  }

With some hackery, we could probably even recognize the last class defined (perhaps by looking at the owner of the last speck’d method was?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant