Sha256: 6e11e88080000facdf64f2be2d0c73055b0f6b4df6d266db54e44d9f63ff98e2
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'ostruct' require_relative 'store' require_relative 'api' require_relative 'pad' module Hackpad module Cli module Padlist module_function def get_list(refresh = false, output = STDOUT) all = [] if refresh || !Store.exist?('padlist') output.print 'Refreshing ' list = Api.list list.each do |a| output.print '.' all << get_pad(a, refresh) end output.puts ' all done.' Store.save_list all else all = Store.read_list end all end def get_pad(id, refresh = false) pad = Pad.new id pad.load 'txt', refresh OpenStruct.new(id: id, title: pad.title) end def get_new all = [] list = Api.list list.each do |a| pad = Pad.new a unless pad.cached? pad.load 'txt' all << OpenStruct.new(id: a, title: pad.title) end end all end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
hackpad-cli-0.1.4 | lib/hackpad/cli/padlist.rb |
hackpad-cli-0.1.3 | lib/hackpad/cli/padlist.rb |
hackpad-cli-0.1.2 | lib/hackpad/cli/padlist.rb |
hackpad-cli-0.1.1 | lib/hackpad/cli/padlist.rb |