patchwork_csv_utils 0.1.19-x86_64-darwin → 0.1.20-x86_64-darwin

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: c566f86e6b5f7dda3afb47413541a2ffa1d61c7f6223b4f1dfd7be6918b41e7c
4
- data.tar.gz: 20efd8d7d1f58ae1331ad627efd6a6b236ed417c29d0248fb752e754cb2ea05b
3
+ metadata.gz: cdf477614b412f9458bb7e3872f2445b8158aff33ea38ca7981f97009acd90cc
4
+ data.tar.gz: 9efc964090af17af18c8dc570f451b9e82de775bb9fb8c1414c54a4ba299db12
5
5
  SHA512:
6
- metadata.gz: d4363b4bcb7aa2fed0d3397484daf5e7ade8c2025890929d2ea5e932529c3ffefa135f3eeff57f47995072f3b88b4b931a21bb4a8420d66535e738f1c6b1dc4c
7
- data.tar.gz: ac32b811b6f111fd4a295a46c57874fb4a41bcdbd796f14eed56a97c30ca2987516cb0e7452b97490768cc5eb099141ff6a3ea8a0c23950b6be331e05f25425b
6
+ metadata.gz: b7b9fa6efe358fd8769ab3b16fb7a9c1cbe18bb7330439e9c8c01110c861434cca94df136516d073a5a37b2260887c9d4bdf6c92a7ef92656d6f4a4627486a28
7
+ data.tar.gz: e2bd9b85b3277938ed6fddf211e9572399165dd8be8d078da6b0ebe48a8870428fa53448e6991f60a040f3141383b754e69272b4eab40e5d4bd425f667c8efbd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patchwork_csv_utils (0.1.19)
4
+ patchwork_csv_utils (0.1.20)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,10 +1,10 @@
1
- use std::collections::HashMap;
2
- use std::fs::File;
3
1
  use chrono::{NaiveDate, NaiveDateTime, NaiveTime, Utc};
4
2
  use csv::{Reader, StringRecord, Writer};
5
3
  use magnus::{Error, RArray, Ruby};
4
+ use std::collections::HashMap;
5
+ use std::fs::File;
6
6
 
7
- use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, create_header_map, missing_value, headers_as_byte_record, index_of_header_in_mandatory_list};
7
+ use crate::utils::{check_mandatory_headers, create_header_map, headers_as_byte_record, index_of_header_in_mandatory_list, magnus_err, missing_header, missing_value, to_datetime_error, FileExtension};
8
8
 
9
9
  pub fn transform_csv(ruby: &Ruby, csv_path: String,
10
10
  target_path: String, exclusions: RArray,
@@ -60,7 +60,7 @@ pub fn transform_csv(ruby: &Ruby, csv_path: String,
60
60
  let column_value = record.get(*column_index).ok_or(missing_value(ruby, column))?;
61
61
  let column_value = column_value.trim_end();
62
62
 
63
- validate_trust_name(ruby, &expected_trust_name, trust_name, ri, i, &column_value.to_string())?;
63
+ validate_trust_name(ruby, &expected_trust_name, trust_name, i, &column_value.to_string())?;
64
64
 
65
65
  if i == *date {
66
66
  let current = string_to_datetime(column_value).ok_or(to_datetime_error(ruby, column_value, ri, "Date"))?;
@@ -88,10 +88,11 @@ pub fn transform_csv(ruby: &Ruby, csv_path: String,
88
88
  }
89
89
 
90
90
 
91
- fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, ri: usize, i: usize, s: &String) -> magnus::error::Result<()> {
91
+ fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, i: usize, s: &String) -> magnus::error::Result<()> {
92
92
  if i == *trust_name {
93
+ let s = s.trim();
93
94
  if s != &expected_trust_name.clone() {
94
- return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
95
+ return Err(Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
95
96
  }
96
97
  }
97
98
  Ok(())
@@ -2,11 +2,11 @@ use std::collections::HashMap;
2
2
  use std::fs::File;
3
3
  use std::io::{BufWriter, Write};
4
4
 
5
- use calamine::{Data, open_workbook, Range, Reader, Xls, open_workbook_auto};
5
+ use calamine::{open_workbook_auto, Data, Range, Reader};
6
6
  use chrono::{NaiveDateTime, Timelike, Utc};
7
7
  use magnus::{RArray, Ruby};
8
8
 
9
- use crate::utils::{FileExtension, magnus_err, missing_header, to_datetime_error, check_mandatory_headers, missing_value, index_of_header_in_mandatory_list};
9
+ use crate::utils::{check_mandatory_headers, index_of_header_in_mandatory_list, magnus_err, missing_header, missing_value, to_datetime_error, FileExtension};
10
10
 
11
11
  pub fn to_csv(ruby: &Ruby, xls_path: String,
12
12
  target_path: String,
@@ -147,6 +147,7 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
147
147
  fn validate_trust_name(ruby: &Ruby, expected_trust_name: &String, trust_name: &usize, ri: usize, r: &Vec<&Data>) -> magnus::error::Result<()> {
148
148
  if ri > 0 {
149
149
  let s = r[*trust_name].to_string();
150
+ let s = s.trim();
150
151
  if s != expected_trust_name.clone() {
151
152
  return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Trust actual name: '{}' is not as expected: '{}'", s, expected_trust_name)));
152
153
  }
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CsvUtils
4
- VERSION = '0.1.19'
4
+ VERSION = '0.1.20'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patchwork_csv_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - kingsley.hendrickse
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Deduplication of CSV files and XLS to CSV conversion.
14
14
  email: