Class: LaunchDarkly::Impl::DataSystem::ProtocolV2::Goodbye Private
- Inherits:
-
Object
- Object
- LaunchDarkly::Impl::DataSystem::ProtocolV2::Goodbye
- Defined in:
- lib/ldclient-rb/impl/data_system/protocolv2.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.
Goodbye represents a goodbye event.
This type is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is not suitable for production usage.
Instance Attribute Summary collapse
-
#catastrophe ⇒ Boolean
readonly
private
Whether this represents a catastrophic failure.
-
#reason ⇒ String
readonly
private
The reason for goodbye.
-
#silent ⇒ Boolean
readonly
private
Whether the goodbye is silent.
Class Method Summary collapse
-
.from_h(data) ⇒ Goodbye
private
Deserializes a Goodbye event from a JSON-compatible hash.
Instance Method Summary collapse
-
#initialize(reason:, silent:, catastrophe:) ⇒ Goodbye
constructor
private
A new instance of Goodbye.
-
#to_h ⇒ Hash
private
Serializes the Goodbye to a JSON-compatible hash.
Constructor Details
#initialize(reason:, silent:, catastrophe:) ⇒ Goodbye
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 Goodbye.
174 175 176 177 178 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 174 def initialize(reason:, silent:, catastrophe:) @reason = reason @silent = silent @catastrophe = catastrophe end |
Instance Attribute Details
#catastrophe ⇒ Boolean (readonly)
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 Whether this represents a catastrophic failure.
167 168 169 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 167 def catastrophe @catastrophe end |
#reason ⇒ String (readonly)
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 The reason for goodbye.
161 162 163 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 161 def reason @reason end |
#silent ⇒ Boolean (readonly)
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 Whether the goodbye is silent.
164 165 166 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 164 def silent @silent end |
Class Method Details
.from_h(data) ⇒ Goodbye
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.
Deserializes a Goodbye event from a JSON-compatible hash.
200 201 202 203 204 205 206 207 208 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 200 def self.from_h(data) reason = data[:reason] silent = data[:silent] catastrophe = data[:catastrophe] raise ArgumentError, "Missing required fields in Goodbye" if reason.nil? || silent.nil? || catastrophe.nil? new(reason: reason, silent: silent, catastrophe: catastrophe) end |
Instance Method Details
#to_h ⇒ Hash
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.
Serializes the Goodbye to a JSON-compatible hash.
185 186 187 188 189 190 191 |
# File 'lib/ldclient-rb/impl/data_system/protocolv2.rb', line 185 def to_h { reason: @reason, silent: @silent, catastrophe: @catastrophe, } end |