Module: Chef::Mixin::PowershellTypeCoercions
- Included in:
- Provider::DscResource
- Defined in:
- lib/chef/mixin/powershell_type_coercions.rb
Instance Method Summary collapse
Instance Method Details
#psobject_conversion(value) ⇒ Object
39 40 41 42 43 |
# File 'lib/chef/mixin/powershell_type_coercions.rb', line 39 def psobject_conversion(value) if value.respond_to?(:to_psobject) "(#{value.to_psobject})" end end |
#translate_type(value) ⇒ Object
45 46 47 |
# File 'lib/chef/mixin/powershell_type_coercions.rb', line 45 def translate_type(value) type_coercion(value) || psobject_conversion(value) || safe_string(value.to_s) end |
#type_coercion(value) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/chef/mixin/powershell_type_coercions.rb', line 24 def type_coercion(value) case value when Integer, Float value.to_s when FalseClass "$false" when TrueClass "$true" when Hash, Chef::Node::ImmutableMash translate_hash(value) when Array, Chef::Node::ImmutableArray translate_array(value) end end |