Afficher un message
Vieux 09/03/2008, 17h58   #1
dkmd_nielsen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Determine "owning" class?

class A
end

class C
def initialize
x = [A.new,A.new]
end

def template
x
end
end

Is it possible for an instance of A to determine the instance of C
that instantiated it?

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. Is the structure
built incorrectly? (It's too late to rebuild at this time.)

Thanks,
dvn
  Réponse avec citation
 
Page generated in 0,24947 seconds with 9 queries