Skip to content

Commit

Permalink
fix array in print_recursive function (in both templates !)
Browse files Browse the repository at this point in the history
closes: voxpupuli#88
  • Loading branch information
trefzer committed Nov 24, 2021
1 parent 6d8b676 commit f7962db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/defines/virtualhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
is_expected.to contain_file(path_avail). \
with_content(%r{^Component "comp1" "muc"$}). \
with_content(%r{^ bo = true;$}). \
with_content(%r{^ arr = { "one"; "two" };$}).\
with_content(%r{^ arr = { "one", "two" };$}).\
with_content(%r{^ str = "string";$})
}
end
Expand Down
2 changes: 1 addition & 1 deletion templates/prosody.cfg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ s2s_secure_domains = {
def print_recursive(object, indentation = 0)
case object
when Array
'{ "' + object.join('"; "') + '" }'
'{ ' + object.map {|v| print_recursive(v, 0)}.join(', ') + ' }'
when Hash
"{\n" + ' ' * (indentation + 2) + object.map {|k,v| "#{k} = " + print_recursive(v, indentation + 2)}.join(";\n" + ' ' * (indentation + 2)) + ";\n" + (' ' * indentation) + '}'
when TrueClass, FalseClass
Expand Down
2 changes: 1 addition & 1 deletion templates/virtualhost.cfg.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VirtualHost "<%= @name %>"
def print_recursive(object, indentation = 0)
case object
when Array
'{ "' + object.join('"; "') + '" }'
'{ ' + object.map {|v| print_recursive(v, 0)}.join(', ') + ' }'
when Hash
"{\n" + ' ' * (indentation + 2) + object.map {|k,v| "#{k} = " + print_recursive(v, indentation + 2)}.join(";\n" + ' ' * (indentation + 2)) + ";\n" + (' ' * indentation) + '}'
when TrueClass, FalseClass
Expand Down

0 comments on commit f7962db

Please sign in to comment.