Skip to content

Instantly share code, notes, and snippets.

@roo
Created March 7, 2012 05:59
Show Gist options
  • Save roo/1991343 to your computer and use it in GitHub Desktop.
Save roo/1991343 to your computer and use it in GitHub Desktop.
def split(value, set)
split_value = set.collect {|s| value.split(s) }.delete_if {|arr| arr.count == 1}
split_value.empty? ? [value] : split_value.first
end
values = split('lot 12, 15', ['-','/',','])
street_number = values.first
street_number_to = values.last
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment