class Dtake::CLI
Public Instance Methods
d(filename)
click to toggle source
# File lib/dtake/cli.rb, line 27 def d(filename) command = "wget https://web.sfc.keio.ac.jp/~takefuji/" + filename system(command) end
find(q)
click to toggle source
# File lib/dtake/cli.rb, line 34 def find(q) list_url = "https://web.sfc.keio.ac.jp/~takefuji/list.html" doc = Nokogiri::HTML(open(list_url)) doc.inner_text.split("\n").each do |line| next if (line == "") #空行は無視 file_name = line.split(" ").last if(file_name.match(q)) puts line end end end
ls()
click to toggle source
# File lib/dtake/cli.rb, line 10 def ls() list_url = "https://web.sfc.keio.ac.jp/~takefuji/list.html" doc = Nokogiri::HTML(open(list_url)) doc.inner_text.split("\n").each do |line| next if (line == "") #空行は無視 date = Date.strptime(line.split[4] + ' ' + line.split[5], '%b %d') if (Date.today - date).floor < 15 puts line else break end end end