Class: LaunchDarkly::Impl::DataStore::DataKind Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/impl/data_store/data_kind.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.

Since:

  • 5.5.0

Constant Summary collapse

FEATURES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0

"features".freeze
SEGMENTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0

"segments".freeze
FEATURE_PREREQ_FN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 5.5.0

lambda { |flag| (flag[:prerequisites] || []).map { |p| p[:key] } }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace:, priority:) ⇒ DataKind

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 DataKind.

Parameters:

  • namespace (String)
  • priority (Integer)

Since:

  • 5.5.0



20
21
22
23
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 20

def initialize(namespace:, priority:)
  @namespace = namespace
  @priority = priority
end

Instance Attribute Details

#namespaceObject (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.

Since:

  • 5.5.0



13
14
15
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 13

def namespace
  @namespace
end

#priorityObject (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.

Since:

  • 5.5.0



14
15
16
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 14

def priority
  @priority
end

Instance Method Details

#[](key) ⇒ 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.

Maintain the same behavior when these data kinds were standard ruby hashes.

Parameters:

  • key (Symbol)

Returns:

  • (Object)

Since:

  • 5.5.0



31
32
33
34
35
36
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 31

def [](key)
  return priority if key == :priority
  return namespace if key == :namespace
  return get_dependency_keys_fn() if key == :get_dependency_keys
  nil
end

#eql?(other) ⇒ Boolean

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:

  • (Boolean)

Since:

  • 5.5.0



47
48
49
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 47

def eql?(other)
  other.is_a?(DataKind) && namespace == other.namespace && priority == other.priority
end

#get_dependency_keys_fnObject

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.

Retrieve the dependency keys for a particular data kind. Right now, this is only defined for flags.

Since:

  • 5.5.0



41
42
43
44
45
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 41

def get_dependency_keys_fn()
  return nil unless @namespace == FEATURES

  FEATURE_PREREQ_FN
end

#hashObject

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.

Since:

  • 5.5.0



51
52
53
# File 'lib/ldclient-rb/impl/data_store/data_kind.rb', line 51

def hash
  [namespace, priority].hash
end