From: Max Doumkine Date: 2013-08-01T06:05:13+09:00 Subject: Re: Method tracker - Need assistance --Apple-Mail=_5F170A8B-1FCE-48F8-BD6A-BC825F6819EF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii You don't have anything that initializes the module, if you want it to = be "auto triggered" then create an initialize method in MethodTracker rough example: module MethodTracker def initialize(method_name=3D"test") puts "Tracking #{method_name}" end end class Factory include MethodTracker def build end end x =3D Factory.new; puts x.build On Jul 31, 2013, at 4:44 PM, Kenny Meyer wrote: > I would like to write an includable method tracker, which logs about = added methods to a class. >=20 > module MethodTracker > def self.method_added(method_name) > puts "Tracking #{method_name}" > end > end >=20 > class Factory > include MethodTracker >=20 > def build > end > end >=20 > This is my code, however when the `Factory` class is defined there is = no message shown. Can you give me a hint? >=20 > Kenny Meyer >=20 > I make Software. > www.kennymeyer.net | +(595) 982 52 74 11 --Apple-Mail=_5F170A8B-1FCE-48F8-BD6A-BC825F6819EF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii You = don't have anything that initializes the module, if you want it to be = "auto triggered" then create an initialize method in = MethodTracker
rough example:

module = MethodTracker
  def = initialize(method_name=3D"test")
    puts "Tracking = #{method_name}"
  = end
end

class = Factory
  include = MethodTracker

  def build
  = end
end

x =3D = Factory.new;
puts = x.build


On Jul 31, 2013, at = 4:44 PM, Kenny Meyer <kenny@kennymeyer.net> = wrote:

I would like to write an includable = method tracker, which logs about added methods to a = class.

module = MethodTracker
  def = self.method_added(method_name)
    puts "Tracking #{method_name}"
  = end
end

class = Factory
  include = MethodTracker

  def build
  = end
end

This is my code, however when the `Factory` class is = defined there is no message shown. Can you give me a hint?

Kenny Meyer

I make Software.
www.kennymeyer.net  |  +(595) 982 52 74 = 11

= --Apple-Mail=_5F170A8B-1FCE-48F8-BD6A-BC825F6819EF--