Class: TurboPresence::Configuration
- Inherits:
-
Object
- Object
- TurboPresence::Configuration
- Defined in:
- lib/turbo_presence/configuration.rb
Instance Attribute Summary collapse
-
#cursor_throttle_ms ⇒ Object
Returns the value of attribute cursor_throttle_ms.
-
#presence_ttl ⇒ Object
Returns the value of attribute presence_ttl.
-
#redis_url ⇒ Object
Returns the value of attribute redis_url.
-
#user_identifier ⇒ Object
readonly
Returns the value of attribute user_identifier.
Instance Method Summary collapse
- #identify_user(&block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
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_ms ⇒ Object
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_ttl ⇒ Object
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_url ⇒ Object
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_identifier ⇒ Object (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 |