censive 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/censive.gemspec +1 -1
  3. data/lib/censive.rb +8 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91f3884b92c79f8cca37066a420c872b612c37ed736f61fa7d11c0f0fd861d8e
4
- data.tar.gz: 71789d006309c1d87e681a7078e718342cb36e1f8a18690c59e51595c49d2e59
3
+ metadata.gz: 3343af27996e08f7c83ae7327e60fc8c225095c457be3141a471f105d596e165
4
+ data.tar.gz: 4ccdfe64a1314628ca9070c5a50678c29933ba87c11b160ec25494a21772090b
5
5
  SHA512:
6
- metadata.gz: d5fe33889abe08bc6aa57bb4dec2d65ef3e8935da5aa209a0bcb6060696de07cf44189ad9be6f43ffcd2897672668bd3aff7e8b713f5070199627e40edd3704f
7
- data.tar.gz: 2c79d30b4682da07800c19eb93067c5c72d471f9abc7b824f7525b3d36b8fb1108d0e733706852f750baac57360af2d5b77527a1daab871e2313d558928ce240
6
+ metadata.gz: 6b5e4d4e3f3f0ec4898fe91ef0f4033c068c68f79fe1acf0f41e45a9d96380751fed6a852920e2a9aa1ae2e477750d972a2838ba5fc7212ea940af534560d183
7
+ data.tar.gz: f58137689118ff3546d9d973ffdd5f9a7f686aa61e4d813e2adf7557b6d0e6303b8f9d9d21bc084ba82f73c50119c522049a066757ab7cead0d5d69dc6037d63
data/censive.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "censive"
5
- s.version = "0.11"
5
+ s.version = "0.12"
6
6
  s.author = "Steve Shreeve"
7
7
  s.email = "steve.shreeve@gmail.com"
8
8
  s.summary =
data/lib/censive.rb CHANGED
@@ -143,7 +143,7 @@ class Censive < StringScanner
143
143
 
144
144
  # returns 2 (must be quoted and escaped), 1 (must be quoted), 0 (neither)
145
145
  def grok(str)
146
- if idx = str.index(/(#{@quote})|#{@sep}|#{@cr}|#{@lf}/o) #!# FIXME: regex injection is possible
146
+ if idx = str.index(/(#{@quote})|#{@sep}|#{@cr}|#{@lf}/o) #!# FIXME: regex injection?
147
147
  $1 ? 2 : str.index(/#{@quote}/o, idx) ? 2 : 1
148
148
  else
149
149
  0
@@ -177,7 +177,13 @@ class Censive < StringScanner
177
177
  end
178
178
  end
179
179
  when :full
180
- row.map {|col| "#{q}#{col.gsub(q, @esc)}#{q}" }
180
+ if @excel
181
+ row.map do |col|
182
+ col =~ /\A0\d*\z/ ? "=#{q}#{col}#{q}" : "#{q}#{col.gsub(q, @esc)}#{q}"
183
+ end
184
+ else
185
+ row.map {|col| "#{q}#{col.gsub(q, @esc)}#{q}" }
186
+ end
181
187
  end.join(s)
182
188
 
183
189
  @out << out + @eol
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: censive
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.4.5
57
+ rubygems_version: 3.4.6
58
58
  signing_key:
59
59
  specification_version: 4
60
60
  summary: A quick and lightweight CSV handling library for Ruby