Skip to content

Commit

Permalink
Use SimpleDelegator for a delegation pattern (#12842)
Browse files Browse the repository at this point in the history
Small refactor to reduce code. The SimpleDelegator standard library allows for the delegation pattern in less code.

Also renames the test to match the tested class path.
  • Loading branch information
pkarman authored and va-bot committed Dec 3, 2019
1 parent c3361d2 commit 3a75164
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions app/workflows/request_issue_closure.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# frozen_string_literal: true

class RequestIssueClosure
def initialize(request_issue)
@request_issue = request_issue
end

delegate :closed_at, :end_product_establishment, :contention_reference_id,
:legacy_issue_optin, :contention_disposition, :canceled!, :close!, to: :request_issue
class RequestIssueClosure < SimpleDelegator
alias request_issue __getobj__

def with_no_decision!
return unless end_product_establishment&.status_cleared?
Expand All @@ -25,8 +20,4 @@ def remove_issue_with_corrected_decision!
request_issue.end_product_establishment&.cancel_unused_end_product!
end
end

private

attr_reader :request_issue
end
File renamed without changes.

0 comments on commit 3a75164

Please sign in to comment.