fixy 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 3af7502122c5bc3bcc6284ad25a631310925775a
4
- data.tar.gz: 2caed3c7e83e9f70bcbb6bde57069021891e21cb
3
+ metadata.gz: 6e07746c49b92817445207fc85916f5e647852b6
4
+ data.tar.gz: 60dfdc9542fa68975f597e1cc583cb66b55acecc
5
5
  SHA512:
6
- metadata.gz: c160c295dfb163a34260470a11e1c54fc39c9f9796ca1deef9d19f54637a13c534fa5ebe1155f16363104b36850b579bb6a40ed778f4e245a7d6a40b31d1a35a
7
- data.tar.gz: 1348d95b39d809752cbfe47729ec4e6631fdb9bfda256ec6eea955589ab739c157324bfd023504fc1814c334083f4f39c99b1321eb11db2e636a8f58244fb0cf
6
+ metadata.gz: 29d42d758cc2bfba96cf64fbf6a1fe2190d5c40348863b0d887dc1ec1521abc1080c116b5202d9b4361108d0050366e88013b4e71870f0fcf131278a46776a06
7
+ data.tar.gz: c6b902cc25409fbf0a340464d36e30207fe3f8de30d6c366cfcee3111bc1efeb1adc4abbde84acc769dd2e39a4e4fc2f3fa24be524679a2f66ef716af18ad4ae
@@ -1,3 +1,7 @@
1
+ ## v0.0.8
2
+
3
+ * Strip line endings from fields in record.
4
+
1
5
  ## v0.0.7
2
6
 
3
7
  * Added support for custom line ending.
@@ -10,7 +10,7 @@ module Fixy
10
10
  #
11
11
 
12
12
  def format_alphanumeric(input, byte_width)
13
- input_string = String.new(input.to_s)
13
+ input_string = String.new(input.to_s).tr "#{self.class::LINE_ENDING_CRLF}#{line_ending}", ''
14
14
  result = ''
15
15
 
16
16
  if input_string.bytesize <= byte_width
@@ -1,3 +1,3 @@
1
1
  module Fixy
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -120,6 +120,23 @@ describe 'Generating a Record' do
120
120
  end
121
121
  end
122
122
 
123
+ context 'when a field value contains the record separator' do
124
+ it 'should strip that separator' do
125
+ class PersonRecordNewLine < Fixy::Record
126
+ include Fixy::Formatter::Alphanumeric
127
+
128
+ set_record_length 9
129
+
130
+ field :name, 9, '1-9' , :alphanumeric
131
+
132
+ field_value :name, -> { "Two\nLine" }
133
+ end
134
+
135
+ value = PersonRecordNewLine.new.generate
136
+ value.should == "TwoLine \n"
137
+ end
138
+ end
139
+
123
140
  context 'when definition is incomplete (e.g. undefined columns)' do
124
141
  it 'should raise an error' do
125
142
  class PersonRecordF < Fixy::Record
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fixy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Skalli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler