fix missing borrowed helper method
This commit is contained in:
Родитель
fb8a76b2e2
Коммит
71e041c2e9
|
@ -9,6 +9,31 @@ property :settings, Hash
|
|||
property :system, [true, false]
|
||||
property :user, String
|
||||
|
||||
action_class do
|
||||
def convert_to_string_from_data_type(value)
|
||||
case value
|
||||
when Array
|
||||
"-array #{value.map { |x| convert_to_string_from_data_type(x) }.join(' ')}"
|
||||
when Integer
|
||||
"-integer #{value}"
|
||||
when FalseClass
|
||||
"-bool #{value}"
|
||||
when TrueClass
|
||||
"-bool #{value}"
|
||||
when Hash
|
||||
"-dict #{value.map do |k, v|
|
||||
Shellwords.shellescape(k) + ' ' + convert_to_string_from_data_type(v)
|
||||
end.join(' ')}"
|
||||
when String
|
||||
"-string #{Shellwords.shellescape(value)}"
|
||||
when Float
|
||||
"-float #{value}"
|
||||
else
|
||||
raise "Unknown or unsupported data type: #{value} of #{value.class}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :run do
|
||||
new_resource.option = 'read' if new_resource.read_only
|
||||
new_resource.settings.each do |setting, value|
|
||||
|
|
Загрузка…
Ссылка в новой задаче