Class: PureMVC::Proxy
Overview
A base IProxy
implementation.
In PureMVC, Proxy
classes are used to manage parts of the application’s data model.
A Proxy
might simply manage a reference to a local data object, in which case interacting with it might involve setting and getting of its data in a synchronous fashion.
Proxy
classes are also used to encapsulate the application’s interaction with remote services to save or retrieve data. In this case, we adopt an asynchronous idiom: setting data (or calling a method) on the Proxy
and listening for a Notification
to be sent when the Proxy
has retrieved the data from the service.
Constant Summary collapse
- NAME =
The name of the
Proxy
. 'Proxy'
Constants inherited from Notifier
Instance Attribute Summary collapse
-
#data ⇒ Object?
The data managed by the proxy.
-
#name ⇒ String
readonly
The proxy name.
Attributes inherited from Notifier
Instance Method Summary collapse
-
#initialize(name = nil, data = nil) ⇒ Proxy
constructor
Initializes a new Proxy instance.
-
#on_register ⇒ Object
Called by the Model when the Proxy is registered.
-
#on_remove ⇒ Object
Called by the Model when the Proxy is removed.
Methods inherited from Notifier
#facade, #initialize_notifier, #send_notification
Constructor Details
Instance Attribute Details
#data ⇒ Object?
Returns The data managed by the proxy.
32 33 34 |
# File 'src/patterns/proxy/proxy.rb', line 32 def data @data end |
#name ⇒ String (readonly)
Returns The proxy name.
29 30 31 |
# File 'src/patterns/proxy/proxy.rb', line 29 def name @name end |
Instance Method Details
#on_register ⇒ Object
Called by the Model when the Proxy is registered
45 |
# File 'src/patterns/proxy/proxy.rb', line 45 def on_register; end |
#on_remove ⇒ Object
Called by the Model when the Proxy is removed
48 |
# File 'src/patterns/proxy/proxy.rb', line 48 def on_remove; end |