Created
January 7, 2020 03:37
-
-
Save lululau/177254d3c3246cf6a20fe935355f55fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Concerns | |
module Institution | |
module IOProcessorAble | |
extend ActiveSupport::Concern | |
def dq_io_processor(params={}) | |
io_processor_of('dq', params) | |
end | |
def hq_io_processor(params={}) | |
io_processor_of('hq', params) | |
end | |
private | |
def io_processor_of(type, params) | |
institution_code = code.camelize | |
params[:exchange] = self if self.class == Exchange | |
params[:consignee] = self if self.class == Consignee | |
format('IOProcessor::%s::%s', type.camelize, institution_code).safe_constantize.try(:new, params) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment