Skip to content

Conversation

@jethrodaniel
Copy link
Contributor

@jethrodaniel jethrodaniel commented Sep 23, 2020

If applied, this commit removes some circular requires.

Prior to this change, we had the following circular requires

require_relative 'entry' unless defined? Net::LDAP::Entry     # dataset
require_relative 'dataset' unless defined? Net::LDAP::Dataset # entry

This works (both classes need each other in methods), but it's unnecessary, since calling require twice does nothing, since
$LOADED_FEATURES has already been updated.

This change moves those requires to the toplevel, and removes the defined? check.


No tests were added, since the existing tests passed without issue.

If applied, this commit removes some circular `require`s.

Prior to this change, we had the following circular `require`s

```
require_relative 'entry' unless defined? Net::LDAP::Entry     # dataset
require_relative 'dataset' unless defined? Net::LDAP::Dataset # entry
```

This works (both classes need each other in methods), but it's
unnecessary, since calling `require` twice does nothing, since
`$LOADED_FEATURES` has already been updated.

This change moves those `require`s to the toplevel, and removes the
`defined?` check.

---

No tests were added, since the existing tests passed without issue.
Copy link
Member

@HarlemSquirrel HarlemSquirrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you!

@HarlemSquirrel HarlemSquirrel merged commit fed3940 into ruby-ldap:master Oct 1, 2020
@jethrodaniel jethrodaniel deleted the fix-circular-require branch October 1, 2020 17:21
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