Skip to content

Instantly share code, notes, and snippets.

@mrbrdo
Last active December 14, 2015 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrbrdo/5044060 to your computer and use it in GitHub Desktop.
Save mrbrdo/5044060 to your computer and use it in GitHub Desktop.
module Kernel
def with(object, &block)
object.instance_eval &block
end
end
# Simple way to use it
with "Ruby Rocks!" do
puts self
puts size
end
# More verbose way of using it
with "Ruby" do |s1|
with "Rocks!" do |s2|
puts "#{s1} #{s2}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment