Permalink
Browse files

Extract Class Step Two

* Move one method to the new class
  • Loading branch information...
jferris committed Feb 14, 2013
1 parent cce3348 commit ac0147507b556a65a370ddcc2b4fab17f277de3f
@@ -7,7 +7,7 @@ def new

def create
@survey = Survey.find(params[:survey_id])
@survey_inviter = SurveyInviter.new
@survey_inviter = SurveyInviter.new(recipients)
if valid_recipients? && valid_message?
recipient_list.each do |email|
invitation = Invitation.create(
@@ -45,7 +45,7 @@ def invalid_recipients
end

def recipient_list
@recipient_list ||= recipients.gsub(/\s+/, '').split(/[\n,;]+/)
@survey_inviter.recipient_list
end

def recipients
@@ -1,2 +1,9 @@
class SurveyInviter
def initialize(recipients)
@recipients = recipients
end

def recipient_list
@recipient_list ||= @recipients.gsub(/\s+/, '').split(/[\n,;]+/)
end
end

0 comments on commit ac01475

Please sign in to comment.