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.
99 100 101 102 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 99 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.
104 105 106 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 104 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.
108 109 110 111 112 113 114 |
# File 'lib/ldclient-rb/impl/big_segments.rb', line 108 def update_status(new_status) if !@last_status || new_status != @last_status @last_status = new_status changed notify_observers(new_status) end end |