Sha256: 2b5db004bed7e09690f3282ea7c4e6a662a5046096562521e2225faaff4eb086

Contents?: true

Size: 631 Bytes

Versions: 6

Compression:

Stored size: 631 Bytes

Contents

require 'singleton'

module Dockdev
  module Context
    class ContextManager
      include Singleton 

      def initialize
        @ctx = {}  
      end

      def register(name, cls)
        @ctx[name] = cls
      end

      def get_context(path)
        ctx = nil
        @ctx.values.each do |v|
          vv = v.init_path(path)
          if vv.is_context?
            ctx = vv
            break
          end
        end
        ctx
      end

    end
  end
end

Dockdev.logger.debug File.join(File.dirname(__FILE__),"context","*.rb")
Dir.glob(File.join(File.dirname(__FILE__),"context","*.rb")).each do |f|
  require f
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dockdev-0.3.5 lib/dockdev/context.rb
dockdev-0.3.4 lib/dockdev/context.rb
dockdev-0.3.3 lib/dockdev/context.rb
dockdev-0.3.2 lib/dockdev/context.rb
dockdev-0.3.1 lib/dockdev/context.rb
dockdev-0.3.0 lib/dockdev/context.rb