class Chef::Resource::MacosUserDefaults
Public Instance Methods
coerce_booleans(val)
click to toggle source
coerce various ways of representing a boolean into either 0 (false) or 1 (true) which is what the defaults CLI expects. Why? Well defaults itself accepts a few different formats, but when you do a read command it all comes back as 1 or 0.
# File lib/chef/resource/macos_userdefaults.rb, line 68 def coerce_booleans(val) return 1 if [true, "TRUE", "1", "true", "YES", "yes"].include?(val) return 0 if [false, "FALSE", "0", "false", "NO", "no"].include?(val) val end
value_type(value)
click to toggle source
# File lib/chef/resource/macos_userdefaults.rb, line 116 def value_type(value) case value when true, false "bool" when Integer "int" when Float "float" when Hash "dict" when Array "array" end end