In a gem I'm working with I found the snippet:
@object.with(&block)
But the method with(&block)
is not defined in the project. It looks like it's defined as a base method inside Ruby somwhere, but I'm not sure.
What does it mean? Can someone point to where that method is defined (like in Object or Class or some other Ruby class)?
Edit:
The code in question:
def self.redis(&block)
raise ArgumentError, "requires a block" if !block
@redis ||= Sidekiq::RedisConnection.create(@hash || {})
@redis.with(&block)
end
It's from the project Sidekiq (https://github.com/mperham/sidekiq). That project also includes the redis-rb
gem (https://github.com/redis/redis-rb). I can't locate a with
method defined in either.
Maybe I'm just missing something.