I'm not sure whether:
ENV.fetch("RAILS_MAX_THREADS") { 5 }
and:
ENV.fetch("RAILS_MAX_THREADS", 5)
are the same or not. What is the difference?
The difference is that the missing variable name is yielded to the block.
In your example, the result is the same because you do not use the yielded string, but try this to see the difference:
ENV.fetch("RAILS_MAX_THREADS", 5)
#=> 5
ENV.fetch("RAILS_MAX_THREADS") { |missing_name| "Could not find env var named " + missing_name }
#=> "Could not find env var named RAILS_MAX_THREADS"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With