Mega Code Archive

 
Categories / Ruby / Method
 

Call method from parameter

def endless_string_succession(start)   while true     yield start     start = start.succ   end end endless_string_succession('fol') do |x|   puts x   break if x[-1] == x[-2] end # fol # fom # fon # foo