voruby 1.0.2 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile.rb +1 -1
- data/lib/voruby/active_votable/active_votable.rb +20 -3
- data/lib/voruby/votables/chandra.rb +5 -5
- data/lib/voruby/votables/cnoc.rb +5 -5
- data/lib/voruby/votables/galex.rb +5 -5
- data/lib/voruby/votables/hst.rb +5 -5
- data/lib/voruby/votables/int.rb +5 -5
- data/lib/voruby/votables/nsa.rb +5 -5
- data/lib/voruby/votables/nsar3.rb +5 -5
- data/lib/voruby/votables/sdss.rb +5 -5
- data/lib/voruby/votables/votable.rb +4 -4
- data/lib/voruby/votables/xmm.rb +5 -5
- data/test/active_votable/database.yml +3 -3
- metadata +2 -2
data/Rakefile.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'voruby/active_votable/loader'
|
2
2
|
|
3
|
+
require 'active_record/connection_adapters/abstract/quoting'
|
4
|
+
|
3
5
|
module VORuby
|
4
6
|
module ActiveVotable
|
5
7
|
|
@@ -121,6 +123,9 @@ module VORuby
|
|
121
123
|
},
|
122
124
|
'TD' => Proc.new{ |name, attrs|
|
123
125
|
@@end_of_cell = false
|
126
|
+
},
|
127
|
+
'TABLEDATA' => Proc.new{ |name, attrs|
|
128
|
+
connection().begin_db_transaction()
|
124
129
|
}
|
125
130
|
},
|
126
131
|
:on_end_element => {
|
@@ -129,11 +134,25 @@ module VORuby
|
|
129
134
|
@@ordered_columns.each_index do |i|
|
130
135
|
row_def[@@ordered_columns[i][:name]] = cast(@@arow[i], @@ordered_columns[i][:type])
|
131
136
|
end
|
132
|
-
|
137
|
+
|
138
|
+
# On my machine, doing this rather than an ActiveRecord.create()
|
139
|
+
# and using begin_db_transaction() and commit_db_transaction()
|
140
|
+
# seems to speed things up by ~2x. The added complexity seemed worth
|
141
|
+
# it to me.
|
142
|
+
values = @@ordered_columns.collect{ |c| connection().quote(row_def[c[:name]]) }
|
143
|
+
connection().insert(
|
144
|
+
"INSERT INTO #{table_name()} " +
|
145
|
+
"(#{@@ordered_columns.collect{ |c| connection().quote_column_name(c[:name]) }.join(', ')}) " +
|
146
|
+
"VALUES (#{values.join(', ')})"
|
147
|
+
)
|
148
|
+
|
133
149
|
@@arow = []
|
134
150
|
},
|
135
151
|
'TD' => Proc.new { |name|
|
136
152
|
@@end_of_cell = true
|
153
|
+
},
|
154
|
+
'TABLEDATA' => Proc.new { |name|
|
155
|
+
connection().commit_db_transaction()
|
137
156
|
}
|
138
157
|
},
|
139
158
|
:on_characters => Proc.new { |chars|
|
@@ -215,8 +234,6 @@ module VORuby
|
|
215
234
|
t.column :resource_num, :integer, :null => false, :default => 1
|
216
235
|
t.column :table_num, :integer, :null => false, :default => 1
|
217
236
|
end
|
218
|
-
|
219
|
-
add_index ActiveVotable::table_name(), [:resource_num, :table_num]
|
220
237
|
end
|
221
238
|
end
|
222
239
|
|
@@ -187,7 +187,7 @@ module VORuby
|
|
187
187
|
def create_headers(res, tbl,
|
188
188
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
189
189
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
190
|
-
header_class)
|
190
|
+
header_class, id=nil)
|
191
191
|
|
192
192
|
headers = Array.new
|
193
193
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -195,11 +195,11 @@ module VORuby
|
|
195
195
|
thead << "<tr>\n"
|
196
196
|
if infer_add_to_cart_ref
|
197
197
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
198
|
-
headers.push('
|
198
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
199
199
|
end
|
200
200
|
if infer_access_ref
|
201
201
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
202
|
-
headers.push(' ')
|
202
|
+
headers.push(' ')
|
203
203
|
end
|
204
204
|
col_count = 0
|
205
205
|
fields(res, tbl).each do |field|
|
@@ -212,7 +212,7 @@ module VORuby
|
|
212
212
|
if field_ucd != 'nil'
|
213
213
|
headers.push(field_ucd)
|
214
214
|
else
|
215
|
-
headers.push(' ')
|
215
|
+
headers.push(' ')
|
216
216
|
end
|
217
217
|
end
|
218
218
|
col_count += 1
|
@@ -379,7 +379,7 @@ module VORuby
|
|
379
379
|
thead = create_headers(res, tbl,
|
380
380
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
381
381
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
382
|
-
header_class)
|
382
|
+
header_class, id)
|
383
383
|
|
384
384
|
# Create body
|
385
385
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/cnoc.rb
CHANGED
@@ -170,7 +170,7 @@ module VORuby
|
|
170
170
|
def create_headers(res, tbl,
|
171
171
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
172
172
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
173
|
-
header_class)
|
173
|
+
header_class, id=nil)
|
174
174
|
|
175
175
|
headers = Array.new
|
176
176
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -178,11 +178,11 @@ module VORuby
|
|
178
178
|
thead << "<tr>\n"
|
179
179
|
if infer_add_to_cart_ref
|
180
180
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
181
|
-
headers.push('
|
181
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
182
182
|
end
|
183
183
|
if infer_access_ref
|
184
184
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
185
|
-
headers.push(' ')
|
185
|
+
headers.push(' ')
|
186
186
|
end
|
187
187
|
col_count = 0
|
188
188
|
fields(res, tbl).each do |field|
|
@@ -195,7 +195,7 @@ module VORuby
|
|
195
195
|
if field_ucd != 'nil'
|
196
196
|
headers.push(field_ucd)
|
197
197
|
else
|
198
|
-
headers.push(' ')
|
198
|
+
headers.push(' ')
|
199
199
|
end
|
200
200
|
end
|
201
201
|
col_count += 1
|
@@ -362,7 +362,7 @@ module VORuby
|
|
362
362
|
thead = create_headers(res, tbl,
|
363
363
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
364
364
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
365
|
-
header_class)
|
365
|
+
header_class, id)
|
366
366
|
|
367
367
|
# Create body
|
368
368
|
tbody = create_body(res, tbl,
|
@@ -167,7 +167,7 @@ module VORuby
|
|
167
167
|
def create_headers(res, tbl,
|
168
168
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
169
169
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
170
|
-
header_class)
|
170
|
+
header_class, id=nil)
|
171
171
|
|
172
172
|
headers = Array.new
|
173
173
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -175,11 +175,11 @@ module VORuby
|
|
175
175
|
thead << "<tr>\n"
|
176
176
|
if infer_add_to_cart_ref
|
177
177
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
178
|
-
headers.push('
|
178
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
179
179
|
end
|
180
180
|
if infer_access_ref
|
181
181
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
182
|
-
headers.push(' ')
|
182
|
+
headers.push(' ')
|
183
183
|
end
|
184
184
|
col_count = 0
|
185
185
|
fields(res, tbl).each do |field|
|
@@ -192,7 +192,7 @@ module VORuby
|
|
192
192
|
if field_ucd != 'nil'
|
193
193
|
headers.push(field_ucd)
|
194
194
|
else
|
195
|
-
headers.push(' ')
|
195
|
+
headers.push(' ')
|
196
196
|
end
|
197
197
|
end
|
198
198
|
col_count += 1
|
@@ -359,7 +359,7 @@ module VORuby
|
|
359
359
|
thead = create_headers(res, tbl,
|
360
360
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
361
361
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
362
|
-
header_class)
|
362
|
+
header_class, id)
|
363
363
|
|
364
364
|
# Create body
|
365
365
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/hst.rb
CHANGED
@@ -168,7 +168,7 @@ module VORuby
|
|
168
168
|
def create_headers(res, tbl,
|
169
169
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
170
170
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
171
|
-
header_class)
|
171
|
+
header_class, id=nil)
|
172
172
|
|
173
173
|
headers = Array.new
|
174
174
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -176,11 +176,11 @@ module VORuby
|
|
176
176
|
thead << "<tr>\n"
|
177
177
|
if infer_add_to_cart_ref
|
178
178
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
179
|
-
headers.push('
|
179
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
180
180
|
end
|
181
181
|
if infer_access_ref
|
182
182
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
183
|
-
headers.push(' ')
|
183
|
+
headers.push(' ')
|
184
184
|
end
|
185
185
|
col_count = 0
|
186
186
|
fields(res, tbl).each do |field|
|
@@ -193,7 +193,7 @@ module VORuby
|
|
193
193
|
if field_ucd != 'nil'
|
194
194
|
headers.push(field_ucd)
|
195
195
|
else
|
196
|
-
headers.push(' ')
|
196
|
+
headers.push(' ')
|
197
197
|
end
|
198
198
|
end
|
199
199
|
col_count += 1
|
@@ -360,7 +360,7 @@ module VORuby
|
|
360
360
|
thead = create_headers(res, tbl,
|
361
361
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
362
362
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
363
|
-
header_class)
|
363
|
+
header_class, id)
|
364
364
|
|
365
365
|
# Create body
|
366
366
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/int.rb
CHANGED
@@ -168,7 +168,7 @@ module VORuby
|
|
168
168
|
def create_headers(res, tbl,
|
169
169
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
170
170
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
171
|
-
header_class)
|
171
|
+
header_class, id=nil)
|
172
172
|
|
173
173
|
headers = Array.new
|
174
174
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -176,11 +176,11 @@ module VORuby
|
|
176
176
|
thead << "<tr>\n"
|
177
177
|
if infer_add_to_cart_ref
|
178
178
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
179
|
-
headers.push('
|
179
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
180
180
|
end
|
181
181
|
if infer_access_ref
|
182
182
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
183
|
-
headers.push(' ')
|
183
|
+
headers.push(' ')
|
184
184
|
end
|
185
185
|
col_count = 0
|
186
186
|
fields(res, tbl).each do |field|
|
@@ -193,7 +193,7 @@ module VORuby
|
|
193
193
|
if field_ucd != 'nil'
|
194
194
|
headers.push(field_ucd)
|
195
195
|
else
|
196
|
-
headers.push(' ')
|
196
|
+
headers.push(' ')
|
197
197
|
end
|
198
198
|
end
|
199
199
|
col_count += 1
|
@@ -360,7 +360,7 @@ module VORuby
|
|
360
360
|
thead = create_headers(res, tbl,
|
361
361
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
362
362
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
363
|
-
header_class)
|
363
|
+
header_class, id)
|
364
364
|
|
365
365
|
# Create body
|
366
366
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/nsa.rb
CHANGED
@@ -170,7 +170,7 @@ module VORuby
|
|
170
170
|
def create_headers(res, tbl,
|
171
171
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
172
172
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
173
|
-
header_class)
|
173
|
+
header_class, id=nil)
|
174
174
|
|
175
175
|
headers = Array.new
|
176
176
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -178,11 +178,11 @@ module VORuby
|
|
178
178
|
thead << "<tr>\n"
|
179
179
|
if infer_add_to_cart_ref
|
180
180
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
181
|
-
headers.push('
|
181
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
182
182
|
end
|
183
183
|
if infer_access_ref
|
184
184
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
185
|
-
headers.push(' ')
|
185
|
+
headers.push(' ')
|
186
186
|
end
|
187
187
|
col_count = 0
|
188
188
|
fields(res, tbl).each do |field|
|
@@ -195,7 +195,7 @@ module VORuby
|
|
195
195
|
if field_ucd != 'nil'
|
196
196
|
headers.push(field_ucd)
|
197
197
|
else
|
198
|
-
headers.push(' ')
|
198
|
+
headers.push(' ')
|
199
199
|
end
|
200
200
|
end
|
201
201
|
col_count += 1
|
@@ -362,7 +362,7 @@ module VORuby
|
|
362
362
|
thead = create_headers(res, tbl,
|
363
363
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
364
364
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
365
|
-
header_class)
|
365
|
+
header_class, id)
|
366
366
|
|
367
367
|
# Create body
|
368
368
|
tbody = create_body(res, tbl,
|
@@ -187,7 +187,7 @@ module VORuby
|
|
187
187
|
def create_headers(res, tbl,
|
188
188
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
189
189
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
190
|
-
header_class)
|
190
|
+
header_class, id=nil)
|
191
191
|
|
192
192
|
headers = Array.new
|
193
193
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -195,11 +195,11 @@ module VORuby
|
|
195
195
|
thead << "<tr>\n"
|
196
196
|
if infer_add_to_cart_ref
|
197
197
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
198
|
-
headers.push('
|
198
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
199
199
|
end
|
200
200
|
if infer_access_ref
|
201
201
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
202
|
-
headers.push(' ')
|
202
|
+
headers.push(' ')
|
203
203
|
end
|
204
204
|
col_count = 0
|
205
205
|
fields(res, tbl).each do |field|
|
@@ -212,7 +212,7 @@ module VORuby
|
|
212
212
|
if field_ucd != 'nil'
|
213
213
|
headers.push(field_ucd)
|
214
214
|
else
|
215
|
-
headers.push(' ')
|
215
|
+
headers.push(' ')
|
216
216
|
end
|
217
217
|
end
|
218
218
|
col_count += 1
|
@@ -379,7 +379,7 @@ module VORuby
|
|
379
379
|
thead = create_headers(res, tbl,
|
380
380
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
381
381
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
382
|
-
header_class)
|
382
|
+
header_class, id)
|
383
383
|
|
384
384
|
# Create body
|
385
385
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/sdss.rb
CHANGED
@@ -170,7 +170,7 @@ module VORuby
|
|
170
170
|
def create_headers(res, tbl,
|
171
171
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
172
172
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
173
|
-
header_class)
|
173
|
+
header_class, id=nil)
|
174
174
|
|
175
175
|
headers = Array.new
|
176
176
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -178,11 +178,11 @@ module VORuby
|
|
178
178
|
thead << "<tr>\n"
|
179
179
|
if infer_add_to_cart_ref
|
180
180
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
181
|
-
headers.push('
|
181
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
182
182
|
end
|
183
183
|
if infer_access_ref
|
184
184
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
185
|
-
headers.push(' ')
|
185
|
+
headers.push(' ')
|
186
186
|
end
|
187
187
|
col_count = 0
|
188
188
|
fields(res, tbl).each do |field|
|
@@ -195,7 +195,7 @@ module VORuby
|
|
195
195
|
if field_ucd != 'nil'
|
196
196
|
headers.push(field_ucd)
|
197
197
|
else
|
198
|
-
headers.push(' ')
|
198
|
+
headers.push(' ')
|
199
199
|
end
|
200
200
|
end
|
201
201
|
col_count += 1
|
@@ -362,7 +362,7 @@ module VORuby
|
|
362
362
|
thead = create_headers(res, tbl,
|
363
363
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
364
364
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
365
|
-
header_class)
|
365
|
+
header_class, id)
|
366
366
|
|
367
367
|
# Create body
|
368
368
|
tbody = create_body(res, tbl,
|
@@ -364,7 +364,7 @@ module VORuby
|
|
364
364
|
def create_headers(res, tbl,
|
365
365
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
366
366
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
367
|
-
header_class)
|
367
|
+
header_class, id=nil)
|
368
368
|
|
369
369
|
headers = Array.new
|
370
370
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -372,11 +372,11 @@ module VORuby
|
|
372
372
|
thead << "<tr>\n"
|
373
373
|
if infer_add_to_cart_ref
|
374
374
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
375
|
-
headers.push('
|
375
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
376
376
|
end
|
377
377
|
if infer_access_ref
|
378
378
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
379
|
-
headers.push(' ')
|
379
|
+
headers.push(' ')
|
380
380
|
end
|
381
381
|
col_count = 0
|
382
382
|
fields(res, tbl).each do |field|
|
@@ -570,7 +570,7 @@ module VORuby
|
|
570
570
|
thead = create_headers(res, tbl,
|
571
571
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
572
572
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
573
|
-
header_class)
|
573
|
+
header_class, id)
|
574
574
|
|
575
575
|
# Create body
|
576
576
|
tbody = create_body(res, tbl,
|
data/lib/voruby/votables/xmm.rb
CHANGED
@@ -171,7 +171,7 @@ module VORuby
|
|
171
171
|
def create_headers(res, tbl,
|
172
172
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
173
173
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
174
|
-
header_class)
|
174
|
+
header_class, id=nil)
|
175
175
|
|
176
176
|
headers = Array.new
|
177
177
|
thead = "<thead class=\"#{header_class}\">\n"
|
@@ -179,11 +179,11 @@ module VORuby
|
|
179
179
|
thead << "<tr>\n"
|
180
180
|
if infer_add_to_cart_ref
|
181
181
|
thead << "<th>#{add_to_cart_header_value}</th>\n"
|
182
|
-
headers.push('
|
182
|
+
headers.push("<a href=\"javascript:void(0);\" onclick=\"siap.addAllRowsToCart('#{id}');\">*</a>")
|
183
183
|
end
|
184
184
|
if infer_access_ref
|
185
185
|
thead << "<th>#{access_ref_header_value}</th>\n"
|
186
|
-
headers.push(' ')
|
186
|
+
headers.push(' ')
|
187
187
|
end
|
188
188
|
col_count = 0
|
189
189
|
fields(res, tbl).each do |field|
|
@@ -196,7 +196,7 @@ module VORuby
|
|
196
196
|
if field_ucd != 'nil'
|
197
197
|
headers.push(field_ucd)
|
198
198
|
else
|
199
|
-
headers.push(' ')
|
199
|
+
headers.push(' ')
|
200
200
|
end
|
201
201
|
end
|
202
202
|
col_count += 1
|
@@ -363,7 +363,7 @@ module VORuby
|
|
363
363
|
thead = create_headers(res, tbl,
|
364
364
|
infer_add_to_cart_ref, add_to_cart_header_value,
|
365
365
|
infer_access_ref, access_ref_header_value, access_ref_col,
|
366
|
-
header_class)
|
366
|
+
header_class, id)
|
367
367
|
|
368
368
|
# Create body
|
369
369
|
tbody = create_body(res, tbl,
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: voruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date: 2006-12-
|
6
|
+
version: "1.1"
|
7
|
+
date: 2006-12-04 00:00:00 -07:00
|
8
8
|
summary: Modules for interacting with the astronomical virtual observatory.
|
9
9
|
require_paths:
|
10
10
|
- lib
|