dumb_quotes 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dumb_quotes.rb +8 -6
- data/test/dumb_quotes_test.rb +2 -0
- metadata +6 -4
data/lib/dumb_quotes.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
1
3
|
module DumbQuotes
|
2
4
|
# Strips whitespace from model fields and converts blank values to nil.
|
3
5
|
def dumb_quotes!(options = nil)
|
@@ -6,14 +8,14 @@ module DumbQuotes
|
|
6
8
|
attributes.each do |attr, value|
|
7
9
|
if value.respond_to?(:gsub)
|
8
10
|
# single quotes
|
9
|
-
value.gsub
|
10
|
-
value.gsub
|
11
|
-
value.gsub
|
11
|
+
value = value.gsub("\xE2\x80\x98","'") # U+2018
|
12
|
+
value = value.gsub("\xE2\x80\x99","'") # U+2019
|
13
|
+
value = value.gsub("\xCA\xBC","'") # U+02BC
|
12
14
|
|
13
15
|
# double quotes
|
14
|
-
value.gsub
|
15
|
-
value.gsub
|
16
|
-
value.gsub
|
16
|
+
value = value.gsub("\xE2\x80\x9C",'"') # U+201C
|
17
|
+
value = value.gsub("\xE2\x80\x9D",'"') # U+201D
|
18
|
+
value = value.gsub("\xCB\xAE",'"') # U+02EE
|
17
19
|
|
18
20
|
record[attr] = value
|
19
21
|
end
|
data/test/dumb_quotes_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumb_quotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "1.
|
4
|
+
version: "1.1"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-23 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -30,6 +30,8 @@ files:
|
|
30
30
|
- README.rdoc
|
31
31
|
has_rdoc: true
|
32
32
|
homepage: http://github.com/yob/dumb_quotes/tree/master
|
33
|
+
licenses: []
|
34
|
+
|
33
35
|
post_install_message:
|
34
36
|
rdoc_options:
|
35
37
|
- --title
|
@@ -52,9 +54,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
54
|
requirements: []
|
53
55
|
|
54
56
|
rubyforge_project: yob-projects
|
55
|
-
rubygems_version: 1.3.
|
57
|
+
rubygems_version: 1.3.5
|
56
58
|
signing_key:
|
57
|
-
specification_version:
|
59
|
+
specification_version: 3
|
58
60
|
summary: a small ActiveRecord plugin that converts 'smart quotes' to their ASCII equivalents
|
59
61
|
test_files:
|
60
62
|
- test/dumb_quotes_test.rb
|