tags:

views:

144

answers:

1

I am trying to write a generic module to extend the World class. I need to access the Before and After hooks from within the module. I am doing this by using the extended method but Before/After does not seem to be available at this point.

module MyWorld
  def MyWorld.extended(obj)
    obj.Before do
      # this doesn't work
    end
  end
end

Is there another way to access these hooks?

+1  A: 

Found out how to do it:

module MyWorld
  def MyWorld.extended(obj)
    Main.Before do
      # some stuff
    end

    Main.After do
      # some other stuff
    end   
  end
end
Derek Ekins