Method: WikiBot::Category#category_info

Defined in:
lib/wikibot/core/category.rb

#category_infoObject


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wikibot/core/category.rb', line 3

def category_info
  @category_info ||= begin
    data = {
      :action => :query,
      :titles => @name,
      :prop => :categoryinfo
    }

    # The query API returns nothing for an empty cat, so we'll return a hash with all the normal
    # properties set to 0 instead
    empty_cat = { :pages => 0, :size => 0, :files => 0, :subcats => 0, :hidden => "" }.to_openhash
    @wiki_bot.query_api(:get, data).query.pages.page.categoryinfo || empty_cat
  end
end