master
1class EmailProcessor
2 attr_reader :email
3
4 def initialize(email)
5 @email = email
6 end
7
8 def process
9 tokens = email.to.map { |x| x[:token] }.uniq
10 User.find(tokens).each do |user|
11 user.add_to_inbox(email)
12 end
13 end
14end