Class: Rapid::Server::Updater

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ury_rapid/server/updater.rb

Overview

Abstract method object that serves a client of the updates API

This is implemented by StreamUpdater and WebSocketUpdater.

Direct Known Subclasses

StreamUpdater, WebSocketUpdater

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Updater

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialises the Updater


17
18
19
20
21
# File 'lib/ury_rapid/server/updater.rb', line 17

def initialize(model)
  @model = model
  @id = nil
  @running = false
end

Class Method Details

.launch(*args) ⇒ Object

Launches an Updater

This is shorthand for initialising an Updater, then calling #run.


26
27
28
# File 'lib/ury_rapid/server/updater.rb', line 26

def self.launch(*args)
  new(*args).run
end

Instance Method Details

#runObject

Runs the Updater


31
32
33
34
35
# File 'lib/ury_rapid/server/updater.rb', line 31

def run
  register
  on_message(&method(:request))
  on_close(&method(:clean_up))
end