Closed brpeterman closed 8 years ago
I'm not sure I see the use of this. Even with your change, this wouldn't work:
bot = Cinch::Bot.new do
configure(@config) do |c, config|
end
end
because inside the first block, @config
already refers to that of the Bot, not yours.
Instead, you could do something like this, which doesn't require a new API:
bot = Cinch::Bot.new
bot.configure do |c|
# @config is my config object, not that of the bot
end
I regret having added #configure
in the first place, I'd prefer not to add more to its API if possible.
Oh, you're absolutely right. I was trying to solve a problem that I no longer had.
For this to work, we'd need to bind the data in Bot.new. Seems like a pretty worthless change.
This is handy if you want to enclose some data when calling #configure. For example, if your program's config object just happens to be named "@config", you can pass it as an argument to configure to bind it to a new name in the scope of the block.