Sha256: b3ba272730d2a486e1013feaf40738ce0eabf932edf23b64f55aa4a50543f5e9

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents


class PackageStore

  def initialize
    @p2n={}
    @n2p={}
  end

  def self.instance
    @@packageStore||=PackageStore.new
  end

  def packages
    vals=@p2n.values
    vals
  end

  def insertPackage(p)
    unless @p2n[p]
      id=p.object_id
      @p2n[p]=id
      @n2p[id]=p
    end
    r=@p2n[p]
    r
  end

  def getID(package)
    @p2n[package]
  end
  def getPackage(id)
    #BasicInterface::pp self.inspect
    @n2p[id]
  end
end


class Package
  def self.add(x)
    PackageStore::instance.insertPackage(x) 
    #BasicInterface::puts "ADDED",x.to_s
  end

  def self.getPackages
    ps=PackageStore::instance.packages
  end
  
end

def self.getPackages
  PackageStore::instance.packages
end

def self.run(object,s)
  PackageStore::instance.getPackage(object).send(*Marshal::load(s))
end


def self.require(f)
  p=RequireInterface::loadPrg(f)
  eval(p)
end

def self.package(name)
  PackageInterface::package(name)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
appswarm-0.0.1 packages/msandbox/package.rb