You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that recently @dg-ratiodata added a helpful method with_env to Aruba::API (#188) that allows you to run a block with environment variables set which are then restored back to original values.
However, the current implementation seems to run the block once for each env var you pass into the hash.
def with_env(env = {}, &block)
env.each do |k,v|
set_env k, v
block.call
restore_env
end
end
Is this the intended behaviour?
Context: I want to set a series of env vars before running my process all together,
I can achieve this by calling the underlying methods directly, but I wondered whether you would be happy for me to change this method to set all the vars just once and then call the block. Something like:
def with_env(env = {}, &block)
env.each do |k,v|
set_env k, v
end
block.call
restore_env
end
Appreciate that this breaks existing behaviour and so might be a breaking change for some people - so I would be happy to rename this method or use an alternative approach.
The text was updated successfully, but these errors were encountered:
Ha no worries on both counts, thanks for addressing this (and for a very
useful library)
On 15 Jan 2015 00:37, "Jarl Friis" notifications@github.com wrote:
Thanks for this.
—
Reply to this email directly or view it on GitHub #223 (comment).
I see that recently @dg-ratiodata added a helpful method
with_env
to Aruba::API (#188) that allows you to run a block with environment variables set which are then restored back to original values.However, the current implementation seems to run the block once for each env var you pass into the hash.
Is this the intended behaviour?
Context: I want to set a series of env vars before running my process all together,
I can achieve this by calling the underlying methods directly, but I wondered whether you would be happy for me to change this method to set all the vars just once and then call the block. Something like:
Appreciate that this breaks existing behaviour and so might be a breaking change for some people - so I would be happy to rename this method or use an alternative approach.
The text was updated successfully, but these errors were encountered: