I remember that this problem came up before but I can't find the answer.
I require a file this way:
#lib/tm/agent/server.rb
require 'tm/agent/server'
And, without calling the Listen class explicitly, its initialize
gets executed:
module Tm
module Agent
module Server
require 'goliath'
class Listen < Goliath::API
def initialize
puts "WHAT"
end
def response(env)
[200, {}, "Hello World"]
end
end
end #end Server
end #end Agent
end #end Tm
How do I avoid initializing the class on require?