Class: FFFFFF::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/0xffffff.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Runner

Returns a new instance of Runner.



80
81
82
83
# File 'lib/0xffffff.rb', line 80

def initialize(path)
  @logger = Logger.new(STDOUT)
  @path = path
end

Instance Method Details

#runObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/0xffffff.rb', line 85

def run
  counter = Counter.new(@path)
  uploader = Uploader.new

  loop do
    counter.count_up do |count|
      raise "finish!" if count > 0xffffff

      Util.create_image(IMAGE_WIDTH, IMAGE_HEIGHT, count) do |path|
        uploader.upload(path)
      end

      @logger.info('upload #%s' % count.to_s(16).rjust(6, '0'))
    end

    Util.wait(1)
  end
end