sunflower 0.5.5 → 0.5.6
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/README +1 -1
- data/lib/sunflower/core.rb +1 -1
- data/lib/sunflower/list.rb +4 -4
- metadata +2 -2
data/README
CHANGED
data/lib/sunflower/core.rb
CHANGED
data/lib/sunflower/list.rb
CHANGED
@@ -46,7 +46,7 @@ class Sunflower::List < Array
|
|
46
46
|
# it will not blow up or return incorrect results; however, text of some other
|
47
47
|
# pages may be missing (it will be lazy-loaded when requested, as usual).
|
48
48
|
def pages_preloaded
|
49
|
-
pgs = self.pages
|
49
|
+
pgs = self.pages.sort_by{|a| a.title}
|
50
50
|
at_once = @sunflower.is_bot? ? 500 : 50
|
51
51
|
|
52
52
|
# this is different from self; page titles are guaranteed to be canonicalized
|
@@ -54,10 +54,12 @@ class Sunflower::List < Array
|
|
54
54
|
|
55
55
|
titles.each_slice(at_once).with_index do |slice, slice_no|
|
56
56
|
res = @sunflower.API('action=query&prop=revisions&rvprop=content&titles='+CGI.escape(slice.join '|'))
|
57
|
-
res['query']['pages'].values.each_with_index do |h, i|
|
57
|
+
res['query']['pages'].values.sort_by{|h| h['title'] || '' }.each_with_index do |h, i|
|
58
58
|
page = pgs[slice_no*at_once + i]
|
59
59
|
|
60
60
|
if h['title'] and h['title'] == page.title
|
61
|
+
page.preloaded_text = true
|
62
|
+
|
61
63
|
if h['missing']
|
62
64
|
page.text = ''
|
63
65
|
elsif h['invalid']
|
@@ -65,8 +67,6 @@ class Sunflower::List < Array
|
|
65
67
|
else
|
66
68
|
page.text = h['revisions'][0]['*']
|
67
69
|
end
|
68
|
-
|
69
|
-
page.preloaded_text = true
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunflower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
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: 2012-
|
12
|
+
date: 2012-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|