Sha256: c7d3f9350d34c1c19295dcb9357f13d5b59d6d86e19157702e8ca18f06d80efb
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require 'delorean/base' module Delorean class AbstractContainer def initialize @engines = {} end def names @engines.keys.map {|n, v| n} end def get(name, version) @engines[ [name, version] ] end def add(name, version, engine) if names.member? name n, v = @engines.keys.detect {|n, v| n == name} raise "Can't import #{name} version #{version}. " + "Collides with imported version #{v}." end @engines[ [name, version] ] = engine end def add_imports(engine) # Given an engine, make sure that all of its imports are added # to the script container. This makes sure we don't have # version conflict among different scripts. engine.imports.each { |name, ev| get(name, ev[1]) || add(name, ev[1], ev[0]) } end def import(name, version) get(name, version) || add(name, version, get_engine(name, version)) end def get_engine(name, version) raise "get_engine needs to be overriden" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
delorean_lang-0.1.7 | lib/delorean/container.rb |
delorean_lang-0.1.6 | lib/delorean/container.rb |
delorean_lang-0.1.5 | lib/delorean/container.rb |
delorean_lang-0.1.04 | lib/delorean/container.rb |