-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Base class to all OperationDetails classes to automate the deta…
…il_code value setting
- Loading branch information
Showing
21 changed files
with
84 additions
and
64 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetails | ||
class Base | ||
def self.inherited(base) | ||
base.singleton_class.prepend( | ||
Module.new do | ||
def apply(operation, line) | ||
operation.instance_variable_set(:"@#{line.detail_code}", line.detail) | ||
|
||
super | ||
end | ||
end, | ||
) | ||
end | ||
end | ||
end | ||
end |
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
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/ibe.rb → lib/cfonb/operation_details/ibe.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class IBE | ||
module OperationDetails | ||
class IBE < Base | ||
ATTRIBUTES = %i[creditor_identifier creditor_identifier_type].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.creditor_identifier = line.detail[0..34].strip | ||
operation.creditor_identifier_type = line.detail[35..-1].strip | ||
end | ||
|
||
CFONB::OperationDetail.register('IBE', self) | ||
CFONB::OperationDetails.register('IBE', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/ipy.rb → lib/cfonb/operation_details/ipy.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class IPY | ||
module OperationDetails | ||
class IPY < Base | ||
ATTRIBUTES = %i[debtor_identifier debtor_identifier_type].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.debtor_identifier = line.detail[0..34].strip | ||
operation.debtor_identifier_type = line.detail[35..-1].strip | ||
end | ||
|
||
CFONB::OperationDetail.register('IPY', self) | ||
CFONB::OperationDetails.register('IPY', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/lc2.rb → lib/cfonb/operation_details/lc2.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class LC2 | ||
module OperationDetails | ||
class LC2 < Base | ||
def self.apply(operation, line) | ||
operation.label += "\n#{line.detail.strip}" | ||
end | ||
|
||
CFONB::OperationDetail.register('LC2', self) | ||
CFONB::OperationDetails.register('LC2', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/lcc.rb → lib/cfonb/operation_details/lcc.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class LCC | ||
module OperationDetails | ||
class LCC < Base | ||
def self.apply(operation, line) | ||
operation.label += "\n#{line.detail.strip}" | ||
end | ||
|
||
CFONB::OperationDetail.register('LCC', self) | ||
CFONB::OperationDetails.register('LCC', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/lcs.rb → lib/cfonb/operation_details/lcs.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class LCS | ||
module OperationDetails | ||
class LCS < Base | ||
def self.apply(operation, line) | ||
operation.label += "\n#{line.detail[0..35].strip}" | ||
end | ||
|
||
CFONB::OperationDetail.register('LCS', self) | ||
CFONB::OperationDetails.register('LCS', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/lib.rb → lib/cfonb/operation_details/lib.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class LIB | ||
module OperationDetails | ||
class LIB < Base | ||
def self.apply(operation, line) | ||
operation.label += "\n#{line.detail.strip}" | ||
end | ||
|
||
CFONB::OperationDetail.register('LIB', self) | ||
CFONB::OperationDetails.register('LIB', self) | ||
end | ||
end | ||
end |
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
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/nbe.rb → lib/cfonb/operation_details/nbe.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class NBE | ||
module OperationDetails | ||
class NBE < Base | ||
ATTRIBUTES = %i[creditor].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.creditor = line.detail.strip | ||
end | ||
|
||
CFONB::OperationDetail.register('NBE', self) | ||
CFONB::OperationDetails.register('NBE', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/nbu.rb → lib/cfonb/operation_details/nbu.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class NBU | ||
module OperationDetails | ||
class NBU < Base | ||
ATTRIBUTES = %i[ultimate_creditor].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.ultimate_creditor = line.detail.strip | ||
end | ||
|
||
CFONB::OperationDetail.register('NBU', self) | ||
CFONB::OperationDetails.register('NBU', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/npo.rb → lib/cfonb/operation_details/npo.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class NPO | ||
module OperationDetails | ||
class NPO < Base | ||
ATTRIBUTES = %i[ultimate_debtor].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.ultimate_debtor = line.detail.strip | ||
end | ||
|
||
CFONB::OperationDetail.register('NPO', self) | ||
CFONB::OperationDetails.register('NPO', self) | ||
end | ||
end | ||
end |
6 changes: 3 additions & 3 deletions
6
lib/cfonb/operation_detail/npy.rb → lib/cfonb/operation_details/npy.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module CFONB | ||
module OperationDetail | ||
class NPY | ||
module OperationDetails | ||
class NPY < Base | ||
ATTRIBUTES = %i[debtor].freeze | ||
|
||
def self.apply(operation, line) | ||
operation.debtor = line.detail.strip | ||
end | ||
|
||
CFONB::OperationDetail.register('NPY', self) | ||
CFONB::OperationDetails.register('NPY', self) | ||
end | ||
end | ||
end |
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
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
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