Class: LaunchDarkly::Impl::BigSegmentStoreStatusProviderImpl Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::BigSegmentStoreStatusProviderImpl
- Defined in:
- lib/ldclient-rb/impl/big_segments.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Default implementation of the BigSegmentStoreStatusProvider interface.
There isn't much to this because the real implementation is in BigSegmentStoreManager - we pass in a lambda that allows us to get the current status from that class. Also, the standard Observer methods such as add_observer are provided for us because BigSegmentStoreStatusProvider mixes in Observer, so all we need to to do make notifications happen is to call the Observer methods "changed" and "notify_observers".
Instance Method Summary collapse
-
#initialize(status_fn) ⇒ BigSegmentStoreStatusProviderImpl
constructor
private
A new instance of BigSegmentStoreStatusProviderImpl.
- #status ⇒ Object private
- #update_status(new_status) ⇒ Object private
Constructor Details
#initialize(status_fn) ⇒ BigSegmentStoreStatusProviderImpl
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.
Returns a new instance of BigSegmentStoreStatusProviderImpl.
120 121 122 123 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 120 def initialize(status_fn) @status_fn = status_fn @last_status = nil end |
Instance Method Details
#status ⇒ Object
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.
125 126 127 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 125 def status @status_fn.call end |
#update_status(new_status) ⇒ Object
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.
129 130 131 132 133 134 135 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 129 def update_status(new_status) if !@last_status || new_status != @last_status @last_status = new_status changed notify_observers(new_status) end end |