Skip to content

Instantly share code, notes, and snippets.

@memetor
Created August 17, 2014 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memetor/4f78c0b993ee38f54e13 to your computer and use it in GitHub Desktop.
Save memetor/4f78c0b993ee38f54e13 to your computer and use it in GitHub Desktop.
ZEN_KAKU_NUM = %w(0 1 2 3 4 5 6 7 8 9)
HAN_KAKU_MAP = ZEN_KAKU_NUM.map.with_index {|n, i| Hash[n, i.to_s]}.reduce(&:merge)
%(0120x).gsub(/[#{ZEN_KAKU_NUM}]/, HAN_KAKU_MAP)
# => 0120x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment