lewis
lewis

Reputation: 141

Kemal configuration using blocks

Kemal currently allows setting configuration options via:

Kemal.config.env = "development" Kemal.config.port = "3456"

I want to do something like with a block:

configuration do |config| config.env = "development" config.port = "3456" ... end

Is this even possible?
Thanks for any insights.

Upvotes: 2

Views: 98

Answers (1)

WPeN2Ic850EU
WPeN2Ic850EU

Reputation: 995

I believe, you could utilize Object#tap method like this:

Kemal.config.tap do |config|
  config.env = "development"
  config.port = "3456"
  ...
end

Upvotes: 5

Related Questions