Module: TurboPresence
- Defined in:
- lib/turbo_presence.rb,
lib/turbo_presence/color.rb,
lib/turbo_presence/railtie.rb,
lib/turbo_presence/version.rb,
lib/turbo_presence/room_token.rb,
lib/turbo_presence/view_helper.rb,
lib/turbo_presence/configuration.rb,
lib/turbo_presence/presence_store.rb
Defined Under Namespace
Modules: Color, ViewHelper
Classes: Configuration, Error, PresenceStore, Railtie, RoomToken
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Class Method Details
.auto_color(user_id) ⇒ Object
36
37
38
|
# File 'lib/turbo_presence.rb', line 36
def auto_color(user_id)
Color.for_user(user_id)
end
|
.configuration ⇒ Object
15
16
17
|
# File 'lib/turbo_presence.rb', line 15
def configuration
@configuration ||= Configuration.new
end
|
19
20
21
|
# File 'lib/turbo_presence.rb', line 19
def configure
yield configuration
end
|
.identify_current_user(user) ⇒ Object
32
33
34
|
# File 'lib/turbo_presence.rb', line 32
def identify_current_user(user)
configuration.user_identifier.call(user).dup
end
|
.initialize_store! ⇒ Object
27
28
29
30
|
# File 'lib/turbo_presence.rb', line 27
def initialize_store!
redis = build_redis
@store = PresenceStore.new(redis: redis, ttl: configuration.presence_ttl)
end
|
.store ⇒ Object
23
24
25
|
# File 'lib/turbo_presence.rb', line 23
def store
@store ||= initialize_store!
end
|