Class: Misc_generator

Inherits:
Object
  • Object
show all
Defined in:
lib/rbmediawiki/misc_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ Misc_generator

Returns a new instance of Misc_generator.



4
5
6
# File 'lib/rbmediawiki/misc_generator.rb', line 4

def initialize(site)
    @site = site
end

Instance Method Details

#history(titles, rvlimit = 50, rvprop = "ids|timestamp|flags|comment|user|size|content", rvstartid = nil, rvendid = nil, rvdir = "older", rvuser = nil, diffto = "prev") ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rbmediawiki/misc_generator.rb', line 19

def history( titles, rvlimit = 50, rvprop = "ids|timestamp|flags|comment|user|size|content", rvstartid = nil, rvendid = nil, rvdir = "older", rvuser = nil, diffto = "prev")
    pages = Hash.new
    finish = false
    while !finish
        result = @site.query_prop_revisions(titles, rvprop, rvlimit, rvstartid, rvendid, nil, nil, rvdir, rvuser, nil, nil, nil, nil, nil, nil, diffto )
        result['query']['pages']['page']['revisions']['rev'].each {|rv|
            puts rv
            yield rv
        }
        if result.key?('query-continue') 
            rvstartid = result['query-continue']['revisions']['rvstartid']
        else
            finish = true
        end
    end
end

#history_diff(titles, rvlimit = 30, rvprop = "timestamp|comment|user|size", rvstartid = nil, rvendid = nil, rvdir = "older", rvuser = nil, diffto = "prev") ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rbmediawiki/misc_generator.rb', line 36

def history_diff( titles, rvlimit = 30, rvprop = "timestamp|comment|user|size", rvstartid = nil, rvendid = nil, rvdir = "older", rvuser= nil, diffto = "prev")
    pages = Hash.new
    finish = false
    while !finish
        result = @site.query_prop_revisions("japonés", rvprop, rvlimit, rvstartid, rvendid, nil, nil, rvdir, rvuser, nil, nil, nil, nil, nil, nil, "prev")
        result['query']['pages']['page']['revisions'].each {|rv|
            yield rv
        }
        if result.key?('query-continue') 
            rvstartid = result['query-continue']['revisions']['rvstartid']
        else
            finish = true
        end
    end
end