cfonb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1666b9858511859d77ab8b3c14a11ee214548b5da5154ee927cf7e51b14eca95
4
- data.tar.gz: 292ed95e4250414dc82ef2967df62663cdadf529d72d8229d5609eee0fb3f0b1
3
+ metadata.gz: 5ba0bfa88edcb3ffba5faa6dbed80c645e237f2a733c27e8f08d3d7232529dd4
4
+ data.tar.gz: f1b37e0493ca187685ec6cc4ccda93ecfa154aa318c97fd794224b9aef0ff0dc
5
5
  SHA512:
6
- metadata.gz: 9c74e319b7448e79163010bea1efeb5a5c5391bd0352b3c38d3145fd41f27ae60b0fe562d25b65698d207418288fb61dc4d49231be968f7dead6905bbc854132
7
- data.tar.gz: a568a83590cfd3666d9ac96ba4dd6c09a39e73aa3a8136904cc24fe25df7d6b5b2f6d3fac74aee01e4ad57bf4455f9d4cf9e55ed993ca8f07f4b440eb103dc8d
6
+ metadata.gz: 261088061d0fab58203fd779bd3ea0ccb6133a8432ec633e189d49f173b8a6dc1d6237b7094d654c714b69c7c7746b48176aa1b7303751ceb5e4b71193b37a4f
7
+ data.tar.gz: 8a6d89059e1dcae01fae5f6dfb16da6519efe300b927729dd22d8464d4806a9bd6a27fb5e980acfc135fb36b69cdb964fb97199654fe69eaf1314040bcde5c44
@@ -3,13 +3,15 @@
3
3
  module CFONB
4
4
  module OperationDetail
5
5
  class RCN
6
+ using CFONB::Refinements::Strings
7
+
6
8
  ATTRIBUTES = %i[reference purpose].freeze
7
9
 
8
10
  def self.apply(operation, line)
9
11
  operation.reference = [
10
12
  operation.reference,
11
- line.detail[0..34].strip
12
- ].compact.join(' - ')
13
+ line.detail[0..34].strip,
14
+ ].filter_map(&:presence).join(' - ')
13
15
 
14
16
  operation.purpose = line.detail[35..-1]&.strip
15
17
  end
@@ -3,13 +3,15 @@
3
3
  module CFONB
4
4
  module OperationDetail
5
5
  class REF
6
+ using CFONB::Refinements::Strings
7
+
6
8
  ATTRIBUTES = %i[reference].freeze
7
9
 
8
10
  def self.apply(operation, line)
9
11
  operation.reference = [
10
12
  operation.reference,
11
13
  line.detail.strip
12
- ].compact.join(' - ')
14
+ ].filter_map(&:presence).join(' - ')
13
15
  end
14
16
 
15
17
  CFONB::OperationDetail.register('REF', self)
@@ -4,7 +4,6 @@ module CFONB
4
4
  module Refinements
5
5
  module Strings
6
6
  refine String do
7
-
8
7
  def first(count = 1)
9
8
  self[..(count - 1)]
10
9
  end
@@ -12,6 +11,10 @@ module CFONB
12
11
  def last(count = 1)
13
12
  self[-count..]
14
13
  end
14
+
15
+ def presence
16
+ strip.empty? ? nil : self
17
+ end
15
18
  end
16
19
  end
17
20
  end
@@ -37,7 +37,8 @@ describe CFONB::Parser do
37
37
  internal_code: '9162',
38
38
  label: "PRLV SEPA TEST CABINET\nMENSUEAUHTR13133",
39
39
  number: 0,
40
- reference: '',
40
+ reference: 'REFERENCE - OTHER REFERENCE',
41
+ purpose: 'PURPOSE',
41
42
  rejection_code: '',
42
43
  unavailability_code: '0',
43
44
  value_date: Date.new(2019, 5, 16),
@@ -55,7 +56,7 @@ describe CFONB::Parser do
55
56
  internal_code: '9162',
56
57
  label: 'VIR SEPA DEMONSTRATION',
57
58
  number: 0,
58
- reference: '',
59
+ reference: 'REFERENCE',
59
60
  rejection_code: '',
60
61
  unavailability_code: '0',
61
62
  value_date: Date.new(2019, 5, 16),
@@ -227,7 +228,7 @@ describe CFONB::Parser do
227
228
  internal_code: '9162',
228
229
  label: "PRLV SEPA TEST CABINET\nMENSUEAUHTR13133",
229
230
  number: 0,
230
- reference: '',
231
+ reference: 'REFERENCE - OTHER REFERENCE',
231
232
  rejection_code: '',
232
233
  unavailability_code: '0',
233
234
  value_date: Date.new(2019, 5, 16),
@@ -245,7 +246,7 @@ describe CFONB::Parser do
245
246
  internal_code: '9162',
246
247
  label: 'VIR SEPA DEMONSTRATION',
247
248
  number: 0,
248
- reference: '',
249
+ reference: 'REFERENCE',
249
250
  rejection_code: '',
250
251
  unavailability_code: '0',
251
252
  value_date: Date.new(2019, 5, 16),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfonb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Le Bray
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-25 00:00:00.000000000 Z
12
+ date: 2023-09-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: An easy to use CFONB format parser
15
15
  email: ''