Class: FinTS::Helper
- Inherits:
-
Object
- Object
- FinTS::Helper
- Defined in:
- lib/fints/helper.rb
Class Method Summary collapse
- .fints_escape(content) ⇒ Object
- .fints_unescape(content) ⇒ Object
- .mt940_to_array(data) ⇒ Object
- .split_for_data_elements(deg) ⇒ Object
- .split_for_data_groups(seg) ⇒ Object
Class Method Details
.fints_escape(content) ⇒ Object
3 4 5 |
# File 'lib/fints/helper.rb', line 3 def self.fints_escape(content) content.gsub('?', '??').gsub('+', '?+').gsub(':', '?:').gsub("'", "?'") end |
.fints_unescape(content) ⇒ Object
7 8 9 |
# File 'lib/fints/helper.rb', line 7 def self.fints_unescape(content) content.gsub('??', '?').gsub("?'", "'").gsub('?+', '+').gsub('?:', ':') end |
.mt940_to_array(data) ⇒ Object
11 12 13 14 15 |
# File 'lib/fints/helper.rb', line 11 def self.mt940_to_array(data) processed_data = data.gsub('@@', "\n").gsub('-0000', '+0000') mt940 = Cmxl.parse(processed_data) mt940.flat_map(&:transactions) end |
.split_for_data_elements(deg) ⇒ Object
21 22 23 |
# File 'lib/fints/helper.rb', line 21 def self.split_for_data_elements(deg) deg.split(/:(?<!\?:)/) end |
.split_for_data_groups(seg) ⇒ Object
17 18 19 |
# File 'lib/fints/helper.rb', line 17 def self.split_for_data_groups(seg) seg.split(/\+(?<!\?\+)/) end |