Guest User

Untitled

a guest
Feb 27th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. {
  2. "title" => "The Dream of %{author}'s %{pet}",
  3. "author" => "%{authorFirst} %{authorLast}",
  4. "authorFirst" => "Jim",
  5. "authorLast" => "Bo",
  6. "pet" => "cat"
  7. }
  8.  
  9. Passing the above function in, the first run through would yield:
  10.  
  11. {
  12. "title" => "The Dream of %{author}'s %{pet}",
  13. "author" => "Jim Bo",
  14. "authorFirst" => "Jim",
  15. "authorLast" => "Bo",
  16. "pet" => "cat"
  17. }
  18.  
  19. which would call itself again since there still exists %{} values, the next run through would yield:
  20.  
  21. {
  22. "title" => "The Dream of Jim Bo's cat",
  23. "author" => "Jim Bo",
  24. "authorFirst" => "Jim",
  25. "authorLast" => "Bo",
  26. "pet" => "cat"
  27. }
Advertisement
Add Comment
Please, Sign In to add comment