class String def perform code code.call self end end #===proc: storing into a variable==== proc_string1 = "Hey there, " proc_code = Proc.new do |n| puts n + "from a proc storing into a variable!" end proc_string1.perform proc_code #===proc: calling like a block==== proc_string2 = "Hey there, " proc_string2.perform( Proc.new do |n| puts n + "from a proc calling like a block!" end) #=== Result === Hey there, from a proc storing into a variable! Hey there, from a proc calling like a block!