#!/usr/local/bin/ruby require 'pp' class AnondArchive attr_reader :url, :year, :month, :year_urls def initialize(url="https://anond.hatelabo.jp/archive/")#, year, month) @url = url; @year = year; @month = month end def add_year @year_urls = [] (6..17).each do |n| n = "0" + n.to_s unless n.to_s =~ %r|^[1][0-7]$| @year = "20" + n.to_s @year_urls << @url + @year end return @year_urls end end sample = AnondArchive.new("https://anond.hatelabo.jp/archive/") #puts sample.url #puts sample.year #puts sample.month pp sample.add_year