class Irasutoya::Category

Attributes

list_url[R]
title[R]

Public Class Methods

all() click to toggle source
# File lib/irasutoya/category.rb, line 16
def all # rubocop:disable Metrics/AbcSize
  fetch_page_and_parse('https://www.irasutoya.com')
    .css('#sidebar-wrapper')
    .css('.widget')
    .select { |w| w.search('h2').text == '詳細カテゴリー' }
    .first
    .css('a')
    .map { |a| a.attribute('href').value }
    .uniq
    .select { |href| href.include?('label') }
    .map { |href| Category.new(title: CGI.unescape(href.split('/')[5]), list_url: href) }
end
new(title:, list_url:) click to toggle source
# File lib/irasutoya/category.rb, line 10
def initialize(title:, list_url:)
  @title = title
  @list_url = list_url
end

Public Instance Methods