Sha256: c50d24d0dd5bf68fd6b4ff436a7306ff32be4901c3f1bd5f1afb325a75b4e13e
Contents?: true
Size: 575 Bytes
Versions: 7
Compression:
Stored size: 575 Bytes
Contents
# frozen_string_literal: true module Nocode module Util # Loads a directory full of Ruby classes and returns their relative paths. 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
7 entries across 7 versions & 1 rubygems