Updated

app/jobs / feedback_email_job.rb

A
24 lines of codes
2 methods
5.2 complexity/method
2 churn
10.42 complexity
0 duplications
class FeedbackEmailJob < EmailJob
  1. FeedbackEmailJob has no descriptive comment
class SendingDisabledError < RuntimeError; end
  1. FeedbackEmailJob::SendingDisabledError has no descriptive comment
self.mailer = FeedbackMailer self.email = :send_feedback rescue_from SendingDisabledError do reschedule_job end before_perform if: :feedback_sending_disabled? do raise SendingDisabledError, "Feedback sending is currently disabled" end private def reschedule_job(time = 1.hour.from_now) self.class.set(wait_until: time).perform_later(*arguments) end def feedback_sending_disabled?
  1. FeedbackEmailJob#feedback_sending_disabled? doesn't depend on instance state (maybe move it to another class?)
Site.disable_feedback_sending? end end