Skip to content

Commit

Permalink
Merge pull request #28 from hidakatsuya/improve-performance-to-not-us…
Browse files Browse the repository at this point in the history
…e-eager-loading

Disable Zeitwerk eager loading to improve performance
  • Loading branch information
hidakatsuya authored Sep 7, 2024
2 parents 2df1c93 + 5a6e7d0 commit 8b7e55b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/rexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ def config

loader = Zeitwerk::Loader.for_gem
loader.setup
loader.eager_load
2 changes: 2 additions & 0 deletions lib/rexer/commands/init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "paint"

module Rexer
module Commands
class Init
Expand Down
2 changes: 1 addition & 1 deletion lib/rexer/definition/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def hooks = @hooks ||= {}
end

def build_source(opts)
type = opts.keys.find { Rexer::Source.names.include?(_1) }
type = opts.keys.find { Rexer::Source.const_defined?(_1.capitalize) }
Source.new(type, opts[type]) if type
end
end
Expand Down
2 changes: 0 additions & 2 deletions lib/rexer/source.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module Rexer
module Source
def self.names = @names ||= []

def self.from_definition(source)
const_get(source.type.capitalize).new(**source.options)
end
Expand Down
4 changes: 0 additions & 4 deletions lib/rexer/source/base.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module Rexer
module Source
class Base
def self.inherited(subclass)
Source.names << subclass.name.split("::").last.downcase.to_sym
end

# Load the source to the given path.
def load(_path)
raise "Not implemented"
Expand Down
1 change: 1 addition & 0 deletions test/integration/integration_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "test_helper"
require "open3"
require "rake"
require "paint"
require "securerandom"

ENV["RUBY_VERSION"] ||= "3.3"
Expand Down

0 comments on commit 8b7e55b

Please sign in to comment.