-
Notifications
You must be signed in to change notification settings - Fork 1
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
IB::Contract in ib-extensions has different superclass (Object) than ib-api #7
Comments
Hi, As ib-extensions depends on ib-api, IB::Contract should always been initialized before the model-file in ib-extensions is parsed. How do you initialize ib-extensions? |
I'm trying to bring in technical-analysis which I think brings in
ib-extensions.
I've run into issues like this before. I believe this bug surfaces
depending on how the filesystem lays out files - different ordering for
different OS installs (even different linux distros). So sometimes
requiring technical-analysis will bring in ib-extensions'
"ib/model/contract" before ib-api's "models/ib/contract".
An easier (while also still robust) way would be to ensure that
ib-extensions' "ib/model/contract.rb" file requires
ib-api's "models/ib/contract". I can submit a PR for that if you prefer.
…On Wed, Nov 10, 2021 at 4:29 AM Hartmut Bischoff ***@***.***> wrote:
Hi,
the contract class in ib-extensions reopens IB::Contract defined in ib-api.
As ib-extensions depends on ib-api, IB::Contract should always been
initilized before the model-file in ib-extension is parsed.
How do you initialize ib-extensions?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABJBGHPVQFPPMOYIRZ2LGLULJCP7ANCNFSM5HS6XIPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Thanks for bringing this to my attention. A proper solution would to use mixins and include/prepend them later. That would translate in a change of the design of ib-extensions. Your opinion? |
That sounds reasonable to me.
In general the thing that is extending a class has to know about that class
and ensure that it is initialized correctly in a certain state. So I always
like to ensure I've required the original "base" class that I'm reopening /
extending.
…On Fri, Nov 12, 2021 at 9:45 PM Hartmut Bischoff ***@***.***> wrote:
Thanks for bringing this to my attention.
You are right, its considered as bad practice to reopen classes across
ruby-gems.
A proper solution would to use mixins and include/prepend them later.
That would translate in a change of the design of ib-extensions.
Your opinion?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABJBGFF32RUNMG2KINZDHLULXNLZANCNFSM5HS6XIPA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
IB::Contract
defined inhttps://github.com/ib-ruby/ib-extensions/blob/master/lib/ib/models/contract.rb
has
Object
as it's superclass (since it doesn't extend any class explicitly)But
IB::Contract
defined inhttps://github.com/ib-ruby/ib-api/blob/master/lib/models/ib/contract.rb
has
IB::Model
as its superclass.As a result, requiring both of these files will cause a mismatched superclass exception:
The text was updated successfully, but these errors were encountered: