Class: TurboPresence::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_presence/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



8
9
10
11
12
13
# File 'lib/turbo_presence/configuration.rb', line 8

def initialize
  @redis_url         = ENV.fetch("REDIS_URL", nil)
  @presence_ttl      = 60
  @cursor_throttle_ms = 50
  @user_identifier   = ->(user) { { id: user.id, name: user.to_s } }
end

Instance Attribute Details

#cursor_throttle_msObject

Returns the value of attribute cursor_throttle_ms.



5
6
7
# File 'lib/turbo_presence/configuration.rb', line 5

def cursor_throttle_ms
  @cursor_throttle_ms
end

#presence_ttlObject

Returns the value of attribute presence_ttl.



5
6
7
# File 'lib/turbo_presence/configuration.rb', line 5

def presence_ttl
  @presence_ttl
end

#redis_urlObject

Returns the value of attribute redis_url.



5
6
7
# File 'lib/turbo_presence/configuration.rb', line 5

def redis_url
  @redis_url
end

#user_identifierObject (readonly)

Returns the value of attribute user_identifier.



6
7
8
# File 'lib/turbo_presence/configuration.rb', line 6

def user_identifier
  @user_identifier
end

Instance Method Details

#identify_user(&block) ⇒ Object



15
16
17
# File 'lib/turbo_presence/configuration.rb', line 15

def identify_user(&block)
  @user_identifier = block
end