Class: Pixiv::WorkList

Inherits:
OwnedIllustList show all
Defined in:
lib/pixiv/work_list.rb

Constant Summary

Constants inherited from OwnedIllustList

OwnedIllustList::ILLUSTS_PER_PAGE

Instance Attribute Summary

Attributes inherited from OwnedIllustList

#last?, #member_id, #page

Attributes inherited from IllustList

#page

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OwnedIllustList

#first?, #max_size, #next_url, #prev_url, #url

Methods inherited from IllustList

#doc, #illust_hashes, #page_class

Methods included from PageCollection

#first?, #last?, #next_attrs, #next_url, #page_class, #prev_attrs, #prev_url, #size

Methods inherited from Page

#bind, #doc, #fetched?, #force, #initialize, lazy_new

Constructor Details

This class inherits a constructor from Pixiv::Page

Class Method Details

.url(member_id, page = 1) ⇒ Object



4
5
6
# File 'lib/pixiv/work_list.rb', line 4

def self.url(member_id, page = 1)
  "#{ROOT_URL}/member_illust.php?id=#{member_id}&p=#{page}"
end

Instance Method Details

#member_nameString?

Returns member_name member_name == nil if this work list is your own.

Returns:

  • (String, nil)

    member_name member_name == nil if this work list is your own



15
16
17
18
# File 'lib/pixiv/work_list.rb', line 15

lazy_attr_reader(:member_name) {
  node = doc.at('.profile-unit h1')
  node && node.inner_text
}

#page_hashesArray<Hash{Symbol=>Object}, nil>

Returns:

  • (Array<Hash{Symbol=>Object}, nil>)


20
21
22
23
24
# File 'lib/pixiv/work_list.rb', line 20

lazy_attr_reader(:page_hashes) {
  node = search!('._image-items li') \
    .xpath('self::node()[not(starts-with(a[1]/@href, "/bookmark"))]')
  node.map {|n| hash_from_list_item(n) }
}

#total_countInteger

Returns:

  • (Integer)


9
10
11
12
# File 'lib/pixiv/work_list.rb', line 9

lazy_attr_reader(:total_count) {
  node = at!('.manage-unit .count-badge')
  node.inner_text[/\d+/].to_i
}