I don't know the first thing about ruby, but I'd like to transform values
in a hash.
The following works in pure ruby:
def replace(hash)
hash.inject({}) do |h,(k,v)|
if v.kind_of? String
h[k] = v.upcase
elsif v.kind_of? Fixnum
h[k] = v
else
h[k] = replace(v)
end
h
end
end
but when I try to use it inside a Vagrantfile, I get errors about inject
being undefined:
/home/mav/Workspaces/i2/new/vagrant_functions/utility.rb:141:in `replace':
undefined method `inject' for nil:NilClass (NoMethodError)
is there any documentation on how to use ruby in vagrantfiles?
Thanks a lot!
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vagrant-up/CAAeLbQK7K_t7JVYOd9ZBYcYmS69%2BwwTTX6RLnRgS3xd66DrtZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.