Sha256: 1443327ea3652bec39756c273ecbe09a8b57f42fbaf9b36a2147983b11b948be

Contents?: true

Size: 896 Bytes

Versions: 3

Compression:

Stored size: 896 Bytes

Contents

module NudgeGP
  class Workstation
    attr_reader :name, :capacity, :couchdb_uri, :factory_name
    attr_accessor :downstream_stations
    attr_accessor :answers
    
    
    def initialize(name, options = {})
      raise ArgumentError, "#{name} is not a Symbol" unless name.kind_of?(Symbol)
      @name = name
      @factory_name = options[:factory_name] || 'factory_name'
      @couchdb_uri = options[:couchdb_uri] || "http://127.0.0.1:5984/#{@factory_name}"
      @capacity = options[:capacity] || 100
      @downstream_stations = Array.new
      @answers = Array.new
    end
    
    
    def transfer_answer(which, where)
      raise ArgumentError, "#{where} is not a Symbol" unless where.kind_of?(Symbol)
      which.remove_tag(self.name)
      which.add_tag(where)
    end
    
    
    def cycle
      self.receive!
      self.build!
      self.ship!
      self.scrap!
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
answer-factory-0.0.3 lib/factories/workstation.rb
answer-factory-0.0.2 lib/factories/workstation.rb
answer-factory-0.0.1 lib/factories/workstation.rb