Module: LiveResource::Methods

Included in:
Resource
Defined in:
lib/live_resource/methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dispatcherObject (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_methodsObject



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

Returns:

  • (Boolean)


28
29
30
# File 'lib/live_resource/methods.rb', line 28

def running?
  @dispatcher && @dispatcher.running?
end

#startObject

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

#stopObject



21
22
23
24
25
26
# File 'lib/live_resource/methods.rb', line 21

def stop
  return if @dispatcher.nil?

  @dispatcher.stop
  self
end