From: Jamey Cribbs Date: 2006-07-25T00:31:02+09:00 Subject: Re: [ANN] Mongoose 0.2.0 Bob Hutchison wrote: > > module Mongoose > def find(klass, &block) > klass.mongoose_find(self, block) > end > > module ClassMethods > def mongoose_find(obj, block) > obj.instance_eval(&block) > end > def check_find(block) > instance_eval(&block) > end > end > > def self.included(klass); > klass.extend(ClassMethods); > end > end > > class Employee > include Mongoose > end > > class Department > include Mongoose > > def initialize > @dept = 'Accounting' > end > > def employees > find(Employee) { puts "FIND: employee.dept == #{@dept}" } > end > end > > Department.new.employees > Thanks! I will study this and try to figure out what you are doing. > > I don't know why I'm arguing this because I actually like the > Employee.find { |emp| emp.dept == @dept } syntax better anyway. What's the old saying about climbing Mt. Everest? "Because it's there!" :-) Jamey Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.