module Af::Application::Proxy
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)
Public Instance Methods
af_logger(logger_name = (af_name || "Unknown"))
click to toggle source
# 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()
click to toggle source
# File lib/fiksu-af/application.rb, line 355 def af_name return ::Af::Application.singleton.af_name end