-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Gem Not Autoloaded - Requires Manual require "toon"
Summary
After installing toon-ruby via the Gemfile and running bundle install, the gem is not autoloaded by Ruby/Rails. Attempting to call Toon.encode results in:
NameError: uninitialized constant Toon
This happens because the gem does not automatically require its main file.
Users must manually add:
require "toon"in config/application.rb or before using the gem.
🔍 Expected Behavior
When a gem is added to the Gemfile and installed, it should automatically require the main library file, so developers can immediately do:
Toon.encode(...)just like with most Ruby gems.
🧪 Actual Behavior
Without a manual require, Rails and Ruby applications cannot find the Toon constant.
Steps to Reproduce
-
Add
toon-rubytoGemfile:gem 'toon-ruby'
-
Run
bundle install -
Attempt to use the gem:
Toon.encode("some string")
-
Result:
NameError: uninitialized constant Toon -
Workaround: Manually add
require "toon"toconfig/application.rbor before usage
Environment
- Ruby version: [Your Ruby version]
- Rails version: [Your Rails version if applicable]
- toon-ruby version: [Version you're using]
Additional Context
Most Ruby gems automatically require their main library file when added to the Gemfile, making them immediately available. This gem requires an additional manual step that could be automated.