Class: Prefab::ConfigValueWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/prefab/config_value_wrapper.rb

Class Method Summary collapse

Class Method Details

.wrap(value, confidential: nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/prefab/config_value_wrapper.rb', line 3

def self.wrap(value, confidential: nil)
  case value
  when Integer
    PrefabProto::ConfigValue.new(int: value, confidential: confidential)
  when Float
    PrefabProto::ConfigValue.new(double: value, confidential: confidential)
  when TrueClass, FalseClass
    PrefabProto::ConfigValue.new(bool: value, confidential: confidential)
  when Array
    PrefabProto::ConfigValue.new(string_list: PrefabProto::StringList.new(values: value.map(&:to_s)), confidential: confidential)
  else
    PrefabProto::ConfigValue.new(string: value.to_s, confidential: confidential)
  end
end