Module: LiveResource::Methods
- Included in:
- Resource
- Defined in:
- lib/live_resource/methods.rb
Instance Attribute Summary collapse
-
#dispatcher ⇒ Object
readonly
Returns the value of attribute dispatcher.
Instance Method Summary collapse
- #remote_methods ⇒ Object
- #running? ⇒ Boolean
-
#start ⇒ Object
Start the method dispatcher for this resource.
- #stop ⇒ Object
Instance Attribute Details
#dispatcher ⇒ Object (readonly)
Returns the value of attribute dispatcher.
5 6 7 |
# File 'lib/live_resource/methods.rb', line 5 def dispatcher @dispatcher end |
Instance Method Details
#remote_methods ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/live_resource/methods.rb', line 32 def remote_methods if self.is_a? Class remote_singleton_methods else self.class.remote_instance_methods end end |
#running? ⇒ Boolean
28 29 30 |
# File 'lib/live_resource/methods.rb', line 28 def running? @dispatcher && @dispatcher.running? end |
#start ⇒ Object
Start the method dispatcher for this resource. On return, the resource will be visible to finders (.all(), etc.) and remote methods may be called.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/live_resource/methods.rb', line 10 def start if @dispatcher @dispatcher.start else @dispatcher = RemoteMethodDispatcher.new(self) end @dispatcher.wait_for_running self end |
#stop ⇒ Object
21 22 23 24 25 26 |
# File 'lib/live_resource/methods.rb', line 21 def stop return if @dispatcher.nil? @dispatcher.stop self end |