Sha256: a332951b63db924399dc695b954f271801cd13a846c9a1ca908563e435521c89

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

require 'alki/dsl/registry'

module Alki
  module Reload
    class DslHandler
      def initialize(root_dir)
        @root_dir = File.join(root_dir,'')
      end

      def handle_path(path)
        dirs.each do |dir|
          dir = File.join(dir,'')
          if path.start_with? dir
            entry = Alki::Dsl::Registry.lookup(path)
            if entry && entry.data[:prefix] && entry.data[:name]
              return [entry.data[:prefix], entry.data[:name]]
            end
          end
        end
        nil
      end

      def dirs
        Alki::Dsl::Registry.registered_dirs.select do |d|
          d.start_with?(@root_dir)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alki-reload-0.1.0 lib/alki/reload/dsl_handler.rb