Created
February 11, 2020 14:14
-
-
Save dramsay/70f3953c24413c3632515f7eac1a20fc to your computer and use it in GitHub Desktop.
Formatting segment targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_segments(segment_string) | |
groups = segment_string.split(/\)\(/) | |
groups.map do |group| | |
group.scan(/\d+/).join(',') | |
end.join(')(').prepend('(') << ')' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment