Sha256: 88eadca053c17ba525d2eddb36bf24d3700fd2086393c1987ae05b5c96567f3e

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

require_relative "store"
require_relative "api"
require_relative "pad"

module Hackpad
  module Cli
    class Padlist

      attr_reader :all

      def initialize(refresh=false)
        if refresh or !Store.exists? "padlist"
          print "Refreshing "
          list = Api.list
          @all = []
          list.each do |a|
            print "."
            pad = Pad.new a
            pad.load 'txt', refresh
            @all << OpenStruct.new( id: a, title: pad.title )
          end
          puts " all done."
          Store.save_list all
        else
          @all = Store.read_list
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackpad-cli-0.0.5 lib/hackpad/cli/padlist.rb