Feature/iprange enhancements#252
Feature/iprange enhancements#252ryanbreed wants to merge 6 commits intorapid7:masterfrom ryanbreed:feature/iprange-enhancements
Conversation
adding private method implementations extracting Nexpose::IPRange and moving spec up
mark argument-specific include? implementations as private
fixing invalid type tests remove test due to class initialization bug
|
@gschneider-r7 @sgreen-r7 - ok here's a cleaned up PR with more concise/consistent unit tests and rubocop style. I can tack on another commit if you'd like me to clean up the hound violations as well. I'll do another PR if you're interested in a refactor of the class implementation. Otherwise, I'd like to start working on specs to get the code coverage up. |
|
I'm not too concerned about the Hound comments on this PR. I'll need to set aside some time with @sgreen-r7 to review the open PRs and get some stuff merged soon hopefully. Thanks again for working on this! |
|
@ryanbreed - Gavin and I looked at this PR for a bit yesterday, and there a few things that don't fit within our "style". However your PR gave us a few really good ideas! I'm going to work on refactoring a bit, and update your PR tomorrow. |
The #include? method now can accept Strings, IPAddr, and Nexpose::IPRange objects when testing for inclusion.
Description
Comparisons have been delegated to private methods #include_iprange? and include_ipaddr? (which passes through to include_iprange?). Care has been taken to preserve old behavior and trap runtime exceptions for compared strings that cannot be coerced into a compatible type. The method will raise a Nexpose::IPRange::IncompatibleType if an attempt is made to compare with an instance that cannot be delegated to a private implementation-specific comparison.
Motivation and Context
This enhancement will behave more correctly in more obvious ways for comparisons to commonly used data types. IPRange has also been extracted from
site.rbinto its own separate file.How Has This Been Tested?
spec/nexpose/ip_range_spec.rb:Types of changes
Checklist: