From: Ken Bloom Date: 2008-03-12T01:10:32+09:00 Subject: Re: Determine "owning" class? On Mon, 10 Mar 2008 17:44:41 -0500, Pit Capitain wrote: > 2008/3/9, dkmd_nielsen : >> The application I'm working on has a class named Template that >> contains an array of Blocks. What I would like to do is have an >> instance of Block reference back to Template's array so that it can >> search for a particular sibling block in the array. > > Where are the blocks created? If they are created inside an instance of > the Template class, then you should be able to get at it from the block: > > class Template > def initialize > @blocks = [lambda{}, lambda{}] > end > attr_reader :blocks > end > > t1 = Template.new > b = t1.blocks.first > t2 = eval("self", b) > t1 == t2 # => true > > Regards, > Pit A block in his question isn't the same as a ruby syntactic block. I think he means a block of content of a web page. --Ken -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/