Sha256: 0459661a83a94744d1582285bbe7f11450a8224797efe761a0e4d46d76675fe9

Contents?: true

Size: 496 Bytes

Versions: 3

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module Nocode
  module Util
    class ClassLoader
      EXTENSION = '.rb'

      attr_reader :dir

      def initialize(dir)
        @dir = dir

        freeze
      end

      def load!
        Dir[File.join(dir, '**', "*#{EXTENSION}")].sort.map do |step_path|
          require step_path

          step_path
            .delete_prefix(dir)
            .delete_prefix(File::SEPARATOR)
            .delete_suffix(EXTENSION)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nocode-0.0.3 lib/nocode/util/class_loader.rb
nocode-0.0.2 lib/nocode/util/class_loader.rb
nocode-0.0.1 lib/nocode/util/class_loader.rb