remote_table 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/remote_table.rb +3 -8
- data/lib/remote_table/format.rb +1 -2
- data/lib/remote_table/local_file.rb +3 -0
- data/lib/remote_table/properties.rb +4 -0
- data/lib/remote_table/version.rb +1 -1
- data/remote_table.gemspec +15 -18
- data/test/helper.rb +0 -1
- data/test/test_old_transform.rb +1 -0
- metadata +164 -162
- data/lib/remote_table/hasher.rb +0 -29
data/lib/remote_table.rb
CHANGED
@@ -13,6 +13,7 @@ require 'active_support/version'
|
|
13
13
|
}.each do |active_support_3_requirement|
|
14
14
|
require active_support_3_requirement
|
15
15
|
end if ::ActiveSupport::VERSION::MAJOR == 3
|
16
|
+
require 'hash_digest'
|
16
17
|
|
17
18
|
class Hash
|
18
19
|
attr_accessor :row_hash
|
@@ -30,12 +31,11 @@ class RemoteTable
|
|
30
31
|
|
31
32
|
# singletons
|
32
33
|
autoload :Executor, 'remote_table/executor'
|
33
|
-
autoload :Hasher, 'remote_table/hasher'
|
34
34
|
|
35
35
|
# Legacy
|
36
36
|
class Transform
|
37
37
|
def self.row_hash(row)
|
38
|
-
::
|
38
|
+
::HashDigest.hexdigest row
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -73,8 +73,8 @@ class RemoteTable
|
|
73
73
|
else
|
74
74
|
mark_download!
|
75
75
|
retval = format.each do |row|
|
76
|
-
row.row_hash = ::RemoteTable.hasher.hash row
|
77
76
|
transformer.transform(row).each do |virtual_row|
|
77
|
+
virtual_row.row_hash = ::HashDigest.hexdigest row
|
78
78
|
if properties.errata
|
79
79
|
next if properties.errata.rejects? virtual_row
|
80
80
|
properties.errata.correct! virtual_row
|
@@ -121,11 +121,6 @@ class RemoteTable
|
|
121
121
|
Executor.instance
|
122
122
|
end
|
123
123
|
|
124
|
-
# Used internally to create unique hashes of rows.
|
125
|
-
def self.hasher
|
126
|
-
Hasher.instance
|
127
|
-
end
|
128
|
-
|
129
124
|
# Used internally to access to a downloaded copy of the file
|
130
125
|
def local_file
|
131
126
|
@local_file ||= LocalFile.new self
|
data/lib/remote_table/format.rb
CHANGED
@@ -58,6 +58,9 @@ class RemoteTable
|
|
58
58
|
::FileUtils.cp t.properties.uri.path, @path
|
59
59
|
else
|
60
60
|
# sabshere 1/20/11 FIXME: ::RemoteTable.config.curl_bin_path or smth
|
61
|
+
# sabshere 7/20/11 make web requests move more slowly so you don't get accused of DOS
|
62
|
+
sleep t.properties.delay_between_requests if t.properties.delay_between_requests
|
63
|
+
$stderr.puts "[remote_table] Downloading #{t.properties.uri.to_s}"
|
61
64
|
::RemoteTable.executor.backtick_with_reporting %{
|
62
65
|
curl
|
63
66
|
--silent
|
@@ -14,6 +14,10 @@ class RemoteTable
|
|
14
14
|
current_options.update options
|
15
15
|
end
|
16
16
|
|
17
|
+
def delay_between_requests
|
18
|
+
current_options['delay_between_requests'] || (::ENV.has_key?('REMOTE_TABLE_DELAY_BETWEEN_REQUESTS') ? ::ENV['REMOTE_TABLE_DELAY_BETWEEN_REQUESTS'].to_i : nil)
|
19
|
+
end
|
20
|
+
|
17
21
|
# The parsed URI of the file to get.
|
18
22
|
def uri
|
19
23
|
return @uri if @uri.is_a?(::URI)
|
data/lib/remote_table/version.rb
CHANGED
data/remote_table.gemspec
CHANGED
@@ -19,26 +19,23 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.
|
23
|
-
s.
|
24
|
-
s.
|
25
|
-
s.
|
26
|
-
s.
|
27
|
-
s.
|
28
|
-
s.
|
29
|
-
s.
|
30
|
-
s.
|
31
|
-
s.
|
32
|
-
s.
|
33
|
-
s.
|
34
|
-
s.
|
22
|
+
s.add_runtime_dependency 'activesupport', '>=2.3.4'
|
23
|
+
s.add_runtime_dependency 'roo', '~>1.9'
|
24
|
+
s.add_runtime_dependency 'fixed_width-multibyte' # TODO replace with fixed_width once timon gets off vacation
|
25
|
+
s.add_runtime_dependency 'i18n' # activesupport?
|
26
|
+
s.add_runtime_dependency 'builder' # roo?
|
27
|
+
s.add_runtime_dependency 'zip' # roo
|
28
|
+
s.add_runtime_dependency 'nokogiri', '>=1.4.1' # roo
|
29
|
+
s.add_runtime_dependency 'spreadsheet' #roo
|
30
|
+
s.add_runtime_dependency 'google-spreadsheet-ruby' #roo
|
31
|
+
s.add_runtime_dependency 'escape', '>=0.0.4'
|
32
|
+
s.add_runtime_dependency 'posix-spawn'
|
33
|
+
s.add_runtime_dependency 'ensure-encoding'
|
34
|
+
s.add_runtime_dependency 'fastercsv', '>=1.5.0'
|
35
|
+
s.add_runtime_dependency 'hash_digest'
|
35
36
|
|
36
37
|
s.add_development_dependency 'errata', '>=0.2.0'
|
37
38
|
s.add_development_dependency 'test-unit'
|
38
39
|
s.add_development_dependency 'shoulda'
|
39
|
-
|
40
|
-
s.add_development_dependency 'ruby-debug19'
|
41
|
-
else
|
42
|
-
s.add_development_dependency 'ruby-debug'
|
43
|
-
end
|
40
|
+
s.add_development_dependency 'rake'
|
44
41
|
end
|
data/test/helper.rb
CHANGED
data/test/test_old_transform.rb
CHANGED
metadata
CHANGED
@@ -1,216 +1,223 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_table
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.4
|
4
5
|
prerelease:
|
5
|
-
version: 1.2.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Seamus Abshere
|
9
9
|
- Andy Rossmeissl
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-11-29 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
18
16
|
name: activesupport
|
19
|
-
|
20
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2164990540 !ruby/object:Gem::Requirement
|
21
18
|
none: false
|
22
|
-
requirements:
|
23
|
-
- -
|
24
|
-
- !ruby/object:Gem::Version
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
25
22
|
version: 2.3.4
|
26
23
|
type: :runtime
|
27
|
-
version_requirements: *id001
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: roo
|
30
24
|
prerelease: false
|
31
|
-
|
25
|
+
version_requirements: *2164990540
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: roo
|
28
|
+
requirement: &2164990040 !ruby/object:Gem::Requirement
|
32
29
|
none: false
|
33
|
-
requirements:
|
30
|
+
requirements:
|
34
31
|
- - ~>
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version:
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
37
34
|
type: :runtime
|
38
|
-
version_requirements: *id002
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: fixed_width-multibyte
|
41
35
|
prerelease: false
|
42
|
-
|
36
|
+
version_requirements: *2164990040
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: fixed_width-multibyte
|
39
|
+
requirement: &2164989660 !ruby/object:Gem::Requirement
|
43
40
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
48
45
|
type: :runtime
|
49
|
-
version_requirements: *id003
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: i18n
|
52
46
|
prerelease: false
|
53
|
-
|
47
|
+
version_requirements: *2164989660
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: i18n
|
50
|
+
requirement: &2164989200 !ruby/object:Gem::Requirement
|
54
51
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version:
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
59
56
|
type: :runtime
|
60
|
-
version_requirements: *id004
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: builder
|
63
57
|
prerelease: false
|
64
|
-
|
58
|
+
version_requirements: *2164989200
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: builder
|
61
|
+
requirement: &2164988780 !ruby/object:Gem::Requirement
|
65
62
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version:
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
70
67
|
type: :runtime
|
71
|
-
version_requirements: *id005
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: zip
|
74
68
|
prerelease: false
|
75
|
-
|
69
|
+
version_requirements: *2164988780
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: zip
|
72
|
+
requirement: &2164988360 !ruby/object:Gem::Requirement
|
76
73
|
none: false
|
77
|
-
requirements:
|
78
|
-
- -
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version:
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
81
78
|
type: :runtime
|
82
|
-
version_requirements: *id006
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: nokogiri
|
85
79
|
prerelease: false
|
86
|
-
|
80
|
+
version_requirements: *2164988360
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: nokogiri
|
83
|
+
requirement: &2164987860 !ruby/object:Gem::Requirement
|
87
84
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
91
88
|
version: 1.4.1
|
92
89
|
type: :runtime
|
93
|
-
version_requirements: *id007
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: spreadsheet
|
96
90
|
prerelease: false
|
97
|
-
|
91
|
+
version_requirements: *2164987860
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: spreadsheet
|
94
|
+
requirement: &2164987440 !ruby/object:Gem::Requirement
|
98
95
|
none: false
|
99
|
-
requirements:
|
100
|
-
- -
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
103
100
|
type: :runtime
|
104
|
-
version_requirements: *id008
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: google-spreadsheet-ruby
|
107
101
|
prerelease: false
|
108
|
-
|
102
|
+
version_requirements: *2164987440
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: google-spreadsheet-ruby
|
105
|
+
requirement: &2164986980 !ruby/object:Gem::Requirement
|
109
106
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version:
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
114
111
|
type: :runtime
|
115
|
-
version_requirements: *id009
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: escape
|
118
112
|
prerelease: false
|
119
|
-
|
113
|
+
version_requirements: *2164986980
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: escape
|
116
|
+
requirement: &2164986480 !ruby/object:Gem::Requirement
|
120
117
|
none: false
|
121
|
-
requirements:
|
122
|
-
- -
|
123
|
-
- !ruby/object:Gem::Version
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
124
121
|
version: 0.0.4
|
125
122
|
type: :runtime
|
126
|
-
version_requirements: *id010
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: posix-spawn
|
129
123
|
prerelease: false
|
130
|
-
|
124
|
+
version_requirements: *2164986480
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: posix-spawn
|
127
|
+
requirement: &2164986060 !ruby/object:Gem::Requirement
|
131
128
|
none: false
|
132
|
-
requirements:
|
133
|
-
- -
|
134
|
-
- !ruby/object:Gem::Version
|
135
|
-
version:
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
136
133
|
type: :runtime
|
137
|
-
version_requirements: *id011
|
138
|
-
- !ruby/object:Gem::Dependency
|
139
|
-
name: ensure-encoding
|
140
134
|
prerelease: false
|
141
|
-
|
135
|
+
version_requirements: *2164986060
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: ensure-encoding
|
138
|
+
requirement: &2164985600 !ruby/object:Gem::Requirement
|
142
139
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
version:
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
147
144
|
type: :runtime
|
148
|
-
version_requirements: *id012
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: fastercsv
|
151
145
|
prerelease: false
|
152
|
-
|
146
|
+
version_requirements: *2164985600
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: fastercsv
|
149
|
+
requirement: &2164985100 !ruby/object:Gem::Requirement
|
153
150
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
157
154
|
version: 1.5.0
|
158
155
|
type: :runtime
|
159
|
-
version_requirements: *id013
|
160
|
-
- !ruby/object:Gem::Dependency
|
161
|
-
name: errata
|
162
156
|
prerelease: false
|
163
|
-
|
157
|
+
version_requirements: *2164985100
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: hash_digest
|
160
|
+
requirement: &2164984680 !ruby/object:Gem::Requirement
|
164
161
|
none: false
|
165
|
-
requirements:
|
166
|
-
- -
|
167
|
-
- !ruby/object:Gem::Version
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: *2164984680
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: errata
|
171
|
+
requirement: &2164984140 !ruby/object:Gem::Requirement
|
172
|
+
none: false
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
168
176
|
version: 0.2.0
|
169
177
|
type: :development
|
170
|
-
version_requirements: *id014
|
171
|
-
- !ruby/object:Gem::Dependency
|
172
|
-
name: test-unit
|
173
178
|
prerelease: false
|
174
|
-
|
179
|
+
version_requirements: *2164984140
|
180
|
+
- !ruby/object:Gem::Dependency
|
181
|
+
name: test-unit
|
182
|
+
requirement: &2165000080 !ruby/object:Gem::Requirement
|
175
183
|
none: false
|
176
|
-
requirements:
|
177
|
-
- -
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version:
|
184
|
+
requirements:
|
185
|
+
- - ! '>='
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
180
188
|
type: :development
|
181
|
-
version_requirements: *id015
|
182
|
-
- !ruby/object:Gem::Dependency
|
183
|
-
name: shoulda
|
184
189
|
prerelease: false
|
185
|
-
|
190
|
+
version_requirements: *2165000080
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: shoulda
|
193
|
+
requirement: &2164999620 !ruby/object:Gem::Requirement
|
186
194
|
none: false
|
187
|
-
requirements:
|
188
|
-
- -
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version:
|
195
|
+
requirements:
|
196
|
+
- - ! '>='
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '0'
|
191
199
|
type: :development
|
192
|
-
version_requirements: *id016
|
193
|
-
- !ruby/object:Gem::Dependency
|
194
|
-
name: ruby-debug19
|
195
200
|
prerelease: false
|
196
|
-
|
201
|
+
version_requirements: *2164999620
|
202
|
+
- !ruby/object:Gem::Dependency
|
203
|
+
name: rake
|
204
|
+
requirement: &2164999200 !ruby/object:Gem::Requirement
|
197
205
|
none: false
|
198
|
-
requirements:
|
199
|
-
- -
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version:
|
206
|
+
requirements:
|
207
|
+
- - ! '>='
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
202
210
|
type: :development
|
203
|
-
|
204
|
-
|
205
|
-
|
211
|
+
prerelease: false
|
212
|
+
version_requirements: *2164999200
|
213
|
+
description: Gives you a standard way to parse various formats and treat them as an
|
214
|
+
array of hashes.
|
215
|
+
email:
|
206
216
|
- seamus@abshere.net
|
207
217
|
executables: []
|
208
|
-
|
209
218
|
extensions: []
|
210
|
-
|
211
219
|
extra_rdoc_files: []
|
212
|
-
|
213
|
-
files:
|
220
|
+
files:
|
214
221
|
- .document
|
215
222
|
- .gitattributes
|
216
223
|
- .gitignore
|
@@ -231,7 +238,6 @@ files:
|
|
231
238
|
- lib/remote_table/format/mixins/textual.rb
|
232
239
|
- lib/remote_table/format/open_office.rb
|
233
240
|
- lib/remote_table/format/xml.rb
|
234
|
-
- lib/remote_table/hasher.rb
|
235
241
|
- lib/remote_table/local_file.rb
|
236
242
|
- lib/remote_table/properties.rb
|
237
243
|
- lib/remote_table/transformer.rb
|
@@ -257,35 +263,31 @@ files:
|
|
257
263
|
- test/test_old_syntax.rb
|
258
264
|
- test/test_old_transform.rb
|
259
265
|
- test/test_remote_table.rb
|
260
|
-
has_rdoc: true
|
261
266
|
homepage: https://github.com/seamusabshere/remote_table
|
262
267
|
licenses: []
|
263
|
-
|
264
268
|
post_install_message:
|
265
269
|
rdoc_options: []
|
266
|
-
|
267
|
-
require_paths:
|
270
|
+
require_paths:
|
268
271
|
- lib
|
269
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
272
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
270
273
|
none: false
|
271
|
-
requirements:
|
272
|
-
- -
|
273
|
-
- !ruby/object:Gem::Version
|
274
|
-
version:
|
275
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ! '>='
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
279
|
none: false
|
277
|
-
requirements:
|
278
|
-
- -
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version:
|
280
|
+
requirements:
|
281
|
+
- - ! '>='
|
282
|
+
- !ruby/object:Gem::Version
|
283
|
+
version: '0'
|
281
284
|
requirements: []
|
282
|
-
|
283
285
|
rubyforge_project: remotetable
|
284
|
-
rubygems_version: 1.
|
286
|
+
rubygems_version: 1.8.10
|
285
287
|
signing_key:
|
286
288
|
specification_version: 3
|
287
289
|
summary: Open local or remote XLSX, XLS, ODS, CSV and fixed-width files.
|
288
|
-
test_files:
|
290
|
+
test_files:
|
289
291
|
- test/helper.rb
|
290
292
|
- test/support/list-en1-semic-3.neooffice.binary.ods
|
291
293
|
- test/support/list-en1-semic-3.neooffice.iso-8859-1.csv
|
data/lib/remote_table/hasher.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
require 'digest/md5'
|
3
|
-
require 'active_support'
|
4
|
-
require 'active_support/version'
|
5
|
-
%w{
|
6
|
-
active_support/core_ext/hash/keys
|
7
|
-
active_support/core_ext/object/to_query
|
8
|
-
}.each do |active_support_3_requirement|
|
9
|
-
require active_support_3_requirement
|
10
|
-
end if ::ActiveSupport::VERSION::MAJOR == 3
|
11
|
-
class RemoteTable
|
12
|
-
class Hasher
|
13
|
-
include ::Singleton
|
14
|
-
def hash(row)
|
15
|
-
str = if row.is_a?(::Array)
|
16
|
-
tmp_ary = []
|
17
|
-
row.each_with_index do |v, i|
|
18
|
-
tmp_ary.push v.to_query(i.to_s)
|
19
|
-
end
|
20
|
-
tmp_ary
|
21
|
-
else
|
22
|
-
row.stringify_keys.keys.sort.map do |k|
|
23
|
-
row[k].to_query k
|
24
|
-
end
|
25
|
-
end.join('&')
|
26
|
-
::Digest::MD5.hexdigest str
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|