-
-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
location_cfg_append can now acccept an array of values #147
Conversation
@@ -3,6 +3,12 @@ | |||
<%= key %> <%= value %>;<% end -%><% end -%> | |||
alias <%= @location_alias %>; | |||
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> | |||
<%= key %> <%= value %>;<% end -%><% end -%> | |||
<% if value.is_a? Array -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about casting value
as an Array with Array()
? That way you can avoid the if then dance here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with all the other examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't even need to do that much. If value
is a String, <% value.each do |sub| %>
will just loop through it once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no each
method on a string object in Ruby 1.9.1 and higher though. http://ruby-doc.org/core-1.9.1/String.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. In that case, I think you can make it an array like so: <% Array(value).each do |sub| %>
@jfryman I'm coming from a non-ruby world, can you show me a quick, proper example so I can commit? Thanks! |
@@ -63,7 +63,6 @@ | |||
exec { 'apt_get_update_for_nginx': | |||
command => '/usr/bin/apt-get update', | |||
timeout => 240, | |||
returns => [ 0, 100 ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be removed for this PR.
Way old. Thanks for taking a pass at this... going to revisit when 🕐 allows. Please reopen and rebase if you wanna take another pass at this. |
Previously, location_cfg_append would only accept a single value, now you can pass an array: