Sha256: 6ace8cc8e742f95c5b52266a41ddb8be2503a44a9653fbe9ebe12790a68d32d8

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

class MonoRepoDeps::Loaders::Base
  include MonoRepoDeps::Mixins

  class << self
    def registry
      @registry ||= {}
    end

    def inherited(subclass)
      name = subclass.to_s.split("::").last.downcase.to_sym

      registry[name] = subclass
    end
  end

  attr_reader :overwriters, :inflections, :ignore_dirs, :autoload_dirs, :loader, :root_path

  def initialize(root_path, &block)
    @root_path = root_path
    @overwriters = []
    @inflections = {}
    @ignore_dirs = []
    @autoload_dirs = []

    instance_exec(&block) if block_given?
  end

  def push_dir(dir)
    @autoload_dirs.push(dir)
  end

  def setup
    raise StandardError.new('not implemented')
  end

  def reload
    raise StandardError.new('not implemented')
  end

  def eager_load
    raise StandardError.new('not implemented')
  end

  def check_classes
    raise StandardError.new('not implemented')
  end

  module SetupDsl
    def inflect(hash)
      @inflections.merge!(hash)
    end

    def overwrite(proc)
      overwriters.push(proc)
    end

    def ignore(glob)
      @ignore_dirs.push(glob)
    end
  end

  include SetupDsl
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mono_repo_deps-0.2.1 lib/mono_repo_deps/loaders/base.rb
mono_repo_deps-0.2.0 lib/mono_repo_deps/loaders/base.rb
mono_repo_deps-0.1.14 lib/mono_repo_deps/loaders/base.rb
mono_repo_deps-0.1.13 lib/mono_repo_deps/loaders/base.rb