Last active
December 14, 2015 06:39
-
-
Save mrbrdo/5044060 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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