Guest User

Untitled

a guest
Nov 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. str = "[ASDF ASDF]"
  2. from, to = [/\[([A-Z][ A-Z_0-9]*)\]/, proc{|s| "\"#{$1.downcase}\""}]
  3. def doit(str, from, to)
  4. str.gsub(from, &to)
  5. end
  6. doit(str, from, to)
  7.  
  8. def doit2(str, from, to)
  9. to = proc{|s| "\"#{$1.downcase}\""}
  10. str.gsub(from, &to)
  11. end
  12. doit2(str, from, to)
  13.  
  14. str.gsub(from, &to)
Add Comment
Please, Sign In to add comment