Method: Kernel#with

Defined in:
lib/shenanigans/kernel/with.rb

#with(o, &blk) ⇒ Object

A Pascal/ActionScript like with method. Yields its argument to the provided block and then returns it.

with([]) do |a|
  a << "a"
  a << "b"
end
#=> ["a", "b"]


9
10
11
# File 'lib/shenanigans/kernel/with.rb', line 9

def with(o, &blk)
  o.tap(&blk)
end