Skip to content

Conversation

@dentarg
Copy link
Member

@dentarg dentarg commented Jan 6, 2026

https://github.com/fxn/zeitwerk

Zeitwerk is an efficient and thread-safe code loader for Ruby.

Given a conventional file structure, Zeitwerk is capable of loading your project's classes and modules on demand (autoloading) or upfront (eager loading). You don't need to write require calls for your own files; instead, you can streamline your programming by knowing that your classes and modules are available everywhere. This feature is efficient, thread-safe, and aligns with Ruby's semantics for constants.

Zeitwerk also supports code reloading, which can be useful during web application development. However, coordination is required to reload in a thread-safe manner. The documentation below explains how to achieve this.

I see this in the logs when code is reloaded

repos/starkast.wiki/lib/controllers/page_controller.rb:6: warning: method redefined; discarding old slug
repos/starkast.wiki/lib/controllers/page_controller.rb:6: warning: previous definition of slug was here
repos/starkast.wiki/lib/controllers/page_controller.rb:10: warning: method redefined; discarding old restrict_concealed
repos/starkast.wiki/lib/controllers/page_controller.rb:10: warning: previous definition of restrict_concealed was here

Maybe it something that can be addressed in Sinatra? sinatra/sinatra#1319

@dentarg dentarg merged commit f6873e1 into main Jan 6, 2026
10 checks passed
@dentarg dentarg deleted the zeitwerk branch January 6, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants