Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def parse_wads(wads, content = {})
unless wads.empty?
wads.each_with_index do |item, index|
if item['text']
scan = item['text'].gsub('\\n', '\n').match(/(?:\s|^)(\S+)@$/m)
if scan && wads[index + 1]
text = wads[index + 1]['text']
content[:email] = scan.to_s.strip.downcase
content[:email] << text if text
end
end
end
end
content
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment