Guest User

Untitled

a guest
Jan 18th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. def call
  2. tries ||= 0
  3.  
  4. begin
  5. puts("#{tries} try")
  6. yield(tries)
  7. rescue
  8. retry if (tries += 1) < 4
  9. puts("i tried...#{tries} times")
  10. end
  11. end
  12.  
  13. call do |tries|
  14. p("block call #{tries}")
  15. end
  16.  
  17. call do
  18. raise
  19. end
Add Comment
Please, Sign In to add comment