Mega Code Archive

 
Categories / Ruby / Method
 

Use Proc new to create a new method

log = Proc.new { |str| puts "[LOG] #{str}" } log.call("A test log message.") # [LOG] A test log message.