Module: MediaWiktory::Wikipedia::Modules::Allcategories
- Defined in:
- lib/mediawiktory/wikipedia/modules/allcategories.rb
Overview
Enumerate all categories.
The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):
api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
.limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
All submodule's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#continue(value) ⇒ self
When more results are available, use this to continue.
-
#dir(value) ⇒ self
Direction to sort in.
-
#from(value) ⇒ self
The category to start enumerating from.
-
#limit(value) ⇒ self
How many categories to return.
-
#max(value) ⇒ self
Only return categories with at most this many members.
-
#min(value) ⇒ self
Only return categories with at least this many members.
-
#prefix(value) ⇒ self
Search for all category titles that begin with this value.
-
#prop(*values) ⇒ self
Which properties to get:.
-
#to(value) ⇒ self
The category to stop enumerating at.
Instance Method Details
#continue(value) ⇒ self
When more results are available, use this to continue.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 33 def continue(value) merge(accontinue: value.to_s) end |
#dir(value) ⇒ self
Direction to sort in.
57 58 59 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 57 def dir(value) _dir(value) or fail ArgumentError, "Unknown value for dir: #{value}" end |
#from(value) ⇒ self
The category to start enumerating from.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 25 def from(value) merge(acfrom: value.to_s) end |
#limit(value) ⇒ self
How many categories to return.
86 87 88 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 86 def limit(value) merge(aclimit: value.to_s) end |
#max(value) ⇒ self
Only return categories with at most this many members.
78 79 80 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 78 def max(value) merge(acmax: value.to_s) end |
#min(value) ⇒ self
Only return categories with at least this many members.
70 71 72 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 70 def min(value) merge(acmin: value.to_s) end |
#prefix(value) ⇒ self
Search for all category titles that begin with this value.
49 50 51 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 49 def prefix(value) merge(acprefix: value.to_s) end |
#prop(*values) ⇒ self
Which properties to get:
94 95 96 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 94 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end |
#to(value) ⇒ self
The category to stop enumerating at.
41 42 43 |
# File 'lib/mediawiktory/wikipedia/modules/allcategories.rb', line 41 def to(value) merge(acto: value.to_s) end |