I read following ruby code:
def callbacks(procs)
procs[:starting].call # line 1
puts "Still going"
procs[:finishing].call # line 2
end
callbacks(:starting => Proc.new { puts "Starting" }, # line 3
:finishing => Proc.new { puts "Finishing" }) # line 4
I can guess what it dose. But I don't know what :starting
and :finishing
in line 1 & 2 mean, and what :starting=>
in line 3 and :finishing=>
in line 4 mean. It's even hard to find a keyword to google.
Could anybody explain line 1,2,3,4 to me? If you may refer some official doc, that will be even better.
:string
equivalent to"starting"
? – TieDad Aug 20 '13 at 08:30