Sha256: 7c073534a0dec3f74a48bd8bb1c69ace8dab31a16d51914dc4923cd5dac4713e

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true
module Prefab
  module ConfigHelper
    def value_of(config_value)
      case config_value.type
      when :string
        config_value.string
      when :int
        config_value.int
      when :double
        config_value.double
      when :bool
        config_value.bool
      when :feature_flag
        config_value.feature_flag
      when :segment
        config_value.segment
      when :log_level
        config_value.log_level
      end
    end

    def value_of_variant(feature_flag_variant)
      return feature_flag_variant.string if feature_flag_variant.has_string?
      return feature_flag_variant.int if feature_flag_variant.has_int?
      return feature_flag_variant.double if feature_flag_variant.has_double?
      return feature_flag_variant.bool if feature_flag_variant.has_bool?
      return nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prefab-cloud-ruby-0.20.0 lib/prefab/config_helper.rb
prefab-cloud-ruby-0.19.0 lib/prefab/config_helper.rb
prefab-cloud-ruby-0.18.0 lib/prefab/config_helper.rb
prefab-cloud-ruby-0.17.0 lib/prefab/config_helper.rb