Skip to content
This repository was archived by the owner on Aug 10, 2025. It is now read-only.

Commit 8b7e55b

Browse files
authored
Merge pull request #28 from hidakatsuya/improve-performance-to-not-use-eager-loading
Disable Zeitwerk eager loading to improve performance
2 parents 2df1c93 + 5a6e7d0 commit 8b7e55b

File tree

6 files changed

+4
-8
lines changed

6 files changed

+4
-8
lines changed

lib/rexer.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ def config
3232

3333
loader = Zeitwerk::Loader.for_gem
3434
loader.setup
35-
loader.eager_load

lib/rexer/commands/init.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "paint"
2+
13
module Rexer
24
module Commands
35
class Init

lib/rexer/definition/dsl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def hooks = @hooks ||= {}
6363
end
6464

6565
def build_source(opts)
66-
type = opts.keys.find { Rexer::Source.names.include?(_1) }
66+
type = opts.keys.find { Rexer::Source.const_defined?(_1.capitalize) }
6767
Source.new(type, opts[type]) if type
6868
end
6969
end

lib/rexer/source.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module Rexer
22
module Source
3-
def self.names = @names ||= []
4-
53
def self.from_definition(source)
64
const_get(source.type.capitalize).new(**source.options)
75
end

lib/rexer/source/base.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
module Rexer
22
module Source
33
class Base
4-
def self.inherited(subclass)
5-
Source.names << subclass.name.split("::").last.downcase.to_sym
6-
end
7-
84
# Load the source to the given path.
95
def load(_path)
106
raise "Not implemented"

test/integration/integration_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require "test_helper"
22
require "open3"
33
require "rake"
4+
require "paint"
45
require "securerandom"
56

67
ENV["RUBY_VERSION"] ||= "3.3"

0 commit comments

Comments
 (0)