Module: Af::Application::Proxy
- Included in:
- TCPCommand::Client, TCPCommand::Server
- Defined in:
- lib/fiksu-af/application.rb
Overview
Proxy’s are used by dependant classes to reach back to the Application frame for some functionality.
consider a model that wishes to use the logging functionality of Af:
class Foo < ActiveRecord::Base
include ::Af::Application::SafeProxy
after_create :do_something_after_create
def foo_logger
return af_logger(self.class.name)
end
private
def do_something_after_create
foo_logger.info "created: #{self.inspect}"
end
end
The difference between Proxy and SafeProxy is simply that SafeProxy can be used in classes that may not be in an Af::Application run (ie, models that are shared with a Rails web app where Af::Application is never instantiated)
Instance Method Summary collapse
Instance Method Details
#af_logger(logger_name = (af_name || "Unknown")) ⇒ Object
351 352 353 |
# File 'lib/fiksu-af/application.rb', line 351 def af_logger(logger_name = (af_name || "Unknown")) return ::Af::Application.singleton.logger(logger_name) end |
#af_name ⇒ Object
355 356 357 |
# File 'lib/fiksu-af/application.rb', line 355 def af_name return ::Af::Application.singleton.af_name end |