entable 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/entable/version.rb +1 -1
- data/lib/entable/xls_export.rb +5 -1
- data/spec/entable/entable_spec.rb +4 -0
- metadata +2 -2
data/lib/entable/version.rb
CHANGED
data/lib/entable/xls_export.rb
CHANGED
|
@@ -44,7 +44,11 @@ module Entable::XlsExport
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def quote_for_xls text
|
|
47
|
-
(text.is_a?(String) && needs_quoting?(text)) ? "=\"#{text}\"" : text
|
|
47
|
+
(text.is_a?(String) && needs_quoting?(text)) ? "=\"#{double_quote text}\"" : text
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def double_quote text
|
|
51
|
+
text.gsub /"/, '""'
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
def needs_quoting? text
|
|
@@ -120,5 +120,9 @@ describe Entable do
|
|
|
120
120
|
</table></body></html>}
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
+
it "should escape double-quotes when necessary" do
|
|
124
|
+
self.class.send :include, Entable::XlsExport
|
|
125
|
+
quote_for_xls('2, "The Hammonds"').should == '="2, ""The Hammonds"""'
|
|
126
|
+
end
|
|
123
127
|
|
|
124
128
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: entable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-06-
|
|
12
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|