Sha256: 1d49724825dee416b3b32b69574bbee9344074a4bd9391835b71c112fd8ae331

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

require "zeitwerk"

module <%= project_class_name %>
  class Autoloader
    class Inflector < Zeitwerk::Inflector
      def camelize(basename, _abspath)
        map = { cli: "CLI", version: "VERSION" }
        map[basename.to_sym] || super
      end
    end

    class << self
      def setup
        loader = Zeitwerk::Loader.new
        loader.inflector = Inflector.new
        loader.push_dir(File.dirname(__dir__)) # lib
<% if project_name.include?('-') -%>
        loader.ignore("#{File.dirname(__dir__)}/<%= project_name %>.rb")
<% end -%>
        loader.setup
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cli-template-4.0.2 lib/templates/default/lib/%underscored_name%/autoloader.rb.tt
cli-template-4.0.1 lib/templates/default/lib/%underscored_name%/autoloader.rb.tt
cli-template-4.0.0 lib/templates/default/lib/%underscored_name%/autoloader.rb.tt