class Qiniu2Upyun::Record
Constants
- PATH
- START_MARKER
Public Instance Methods
delete()
click to toggle source
# File lib/qiniu2upyun/record.rb, line 16 def delete File.delete(PATH) if File.exists?(PATH) end
get()
click to toggle source
# File lib/qiniu2upyun/record.rb, line 6 def get File.exists?(PATH) ? File.open(PATH, 'r').read.split(':') : [START_MARKER, nil] end
recording() { |marker, key| ... }
click to toggle source
# File lib/qiniu2upyun/record.rb, line 20 def recording(&block) marker, key = get if key puts "Migration is not completed on time.(marker: #{marker}, key: #{key})" puts " 1: Continue" puts " 2: Restart" print "Input: " case gets.chomp.to_i when 1 when 2 then marker, key = START_MARKER, nil else raise NoActionError end end yield(marker, key) delete end
set(marker, key) { || ... }
click to toggle source
# File lib/qiniu2upyun/record.rb, line 10 def set(marker, key) yield if block_given? File.open(PATH, 'w').write("#{marker}:#{key}") end