Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoloading the VERSION constant #530

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

skipkayhil
Copy link
Contributor

While waiting for Statesman to support gap lock protection for Trilogy by default (#528) , I wanted to add a conditional monkeypatch to my Rails app based on the version of Statesman loaded. However, trying to reference Statesman::VERSION leads to an error:

$ irb
irb(main):001> require "statesman"
=> true
irb(main):002> Statesman::VERSION
(irb):2:in `<main>': uninitialized constant Statesman::VERSION (NameError)
Did you mean?  Statesman::Version
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/bin/irb:25:in `load'
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/bin/irb:25:in `<main>'

This commit fixes the issue by changing the autoload for the version.rb file to point to VERSION instead of Version (which does not exist).

skipkayhil and others added 2 commits January 4, 2024 15:49
While waiting for Statesman to support gap lock protection for Trilogy
by default, I wanted to add a conditional monkeypatch to my Rails app
based on the version of Statesman loaded. However, trying to reference
`Statesman::VERSION` leads to an error:

```
$ irb
irb(main):001> require "statesman"
=> true
irb(main):002> Statesman::VERSION
(irb):2:in `<main>': uninitialized constant Statesman::VERSION (NameError)
Did you mean?  Statesman::Version
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.11.0/exe/irb:9:in `<top (required)>'
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/bin/irb:25:in `load'
        from /home/hartley/.cache/asdf/installs/ruby/3.2.2/bin/irb:25:in `<main>'
```

This commit fixes the issue by changing the autoload for the `version.rb`
file to point to `VERSION` instead of `Version` (which does not exist).
@stephenbinns stephenbinns merged commit 23f42c6 into gocardless:master Jan 5, 2024
78 checks passed
@skipkayhil skipkayhil deleted the hm-fix-version-autoload branch January 5, 2024 16:32
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.

None yet

2 participants