Sha256: c8c23f1633f6d36cd6bcab1763ec307bedfac6fcca44ca5986d129024bb31887

Contents?: true

Size: 624 Bytes

Versions: 30

Compression:

Stored size: 624 Bytes

Contents

require 'open-uri'

module Dataset

  $dataset = []
  LOCK = Mutex.new

  def self.start
    Thread.new do
      loop do
        $dataset.each do |url|
          print "Open #{url} "
          begin
            open(url)
            puts "SUCCESS"
          rescue => err
            puts "FAILURE #{err.message}"
          end
          sleep 1
        end
      end
    end
  end

  def self.<<(url)
    if not $started
      $started = true
      start
    end
    LOCK.lock
    $dataset << url
    $dataset.uniq!
    LOCK.unlock
  end

  def self.rm(url)
    LOCK.lock
    $dataset.remove url
    LOCK.unlock
  end

end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
nephos-server-0.7.2 app/dataset.rb
nephos-server-0.7.1 app/dataset.rb
nephos-server-0.7.0 app/dataset.rb
nephos-server-0.6.9 app/dataset.rb
nephos-server-0.6.8 app/dataset.rb
nephos-server-0.6.7 app/dataset.rb
nephos-server-0.6.5 app/dataset.rb
nephos-server-0.6.4 app/dataset.rb
nephos-server-0.6.3 app/dataset.rb
nephos-server-0.6.2 app/dataset.rb
nephos-server-0.6.1 app/dataset.rb
nephos-server-0.5.4 app/dataset.rb
nephos-server-0.5.2 app/dataset.rb
nephos-server-0.5.0 app/dataset.rb
nephos-server-0.4.8 app/dataset.rb
nephos-server-0.4.7 app/dataset.rb
nephos-server-0.4.6 app/dataset.rb
nephos-server-0.4.5 app/dataset.rb
nephos-server-0.4.4 app/dataset.rb
nephos-server-0.4.3 app/dataset.rb