Sha256: 5257653e57aab91f2841cb34805a57f390b8b19ab7c293683310ee7575ebb779

Contents?: true

Size: 675 Bytes

Versions: 8

Compression:

Stored size: 675 Bytes

Contents

require 'json'

module Papercall
  # Fetches submissions from file.
  # Params:
  # +filename+:: File with submissions. JSON format.
  class FileFetcher < Fetcher
    def initialize(filename)
      @filename = filename
      @submitted = []
      @accepted = []
      @rejected = []
      @waitlist = []
      @declined = []
    end

    def fetch(_)
      file = File.new(@filename, 'r')
      puts "Reading from file (#{file.path})..."
      submissions = JSON.parse file.read if file
      @submitted = submissions['submitted']
      @accepted = submissions['accepted']
      @rejected = submissions['rejected']
      @waitlist = submissions['waitlist']
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
papercall-0.15.2 lib/papercall/file_fetcher.rb
papercall-0.15.1 lib/papercall/file_fetcher.rb
papercall-0.15.0 lib/papercall/file_fetcher.rb
papercall-0.14.0 lib/papercall/file_fetcher.rb
papercall-0.13.0 lib/papercall/file_fetcher.rb
papercall-0.12.0 lib/papercall/file_fetcher.rb
papercall-0.11.0 lib/papercall/file_fetcher.rb
papercall-0.10.0 lib/papercall/file_fetcher.rb