File: gem_inflector.rb

package info (click to toggle)
ruby-zeitwerk 2.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 732 kB
  • sloc: ruby: 6,240; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Zeitwerk
  class GemInflector < Inflector
    #: (String) -> void
    def initialize(root_file)
      namespace     = File.basename(root_file, ".rb")
      root_dir      = File.dirname(root_file)
      @version_file = File.join(root_dir, namespace, "version.rb")
    end

    #: (String, String) -> String
    def camelize(basename, abspath)
      abspath == @version_file ? "VERSION" : super
    end
  end
end