Sha256: 44d1803b195ddc47caf8458f04525adbcbc1a300e1c23a166ee7177389a21ace

Contents?: true

Size: 655 Bytes

Versions: 1

Compression:

Stored size: 655 Bytes

Contents

require 'ostruct'
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.6 lib/hackpad/cli/padlist.rb