Skip to content

Conversation

@fr3nch13
Copy link
Contributor

Closes #98

else
if netbox_object.respond_to?(filter_key)
netbox_object.public_send(filter_key).to_s == filter_value.to_s
if netbox_object.public_send(filter_key).respond_to?(:to_string)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there is a better solution for this issue 🤔 . This would apply for all resources and it's not very clear if I just look at the code why this happens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would've added a comment into the code, but I was trying to stick to your style.

I can do that if you want.

Copy link
Member

Choose a reason for hiding this comment

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

I think more about checking for IPAddress explicitly and use to_string there instead of to_s.

case netbox_object
when IPAddress
...

Copy link
Contributor Author

@fr3nch13 fr3nch13 Apr 22, 2025

Choose a reason for hiding this comment

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

Yeah, I was thinking that too. I just haven't updated the PR yet.

The only downside is if you decide to swap IpAddress for something like ipaddr, which also uses to_string.

@fr3nch13
Copy link
Contributor Author

fr3nch13 commented Apr 22, 2025

FIY, I submitted a RP to the IpAddress gem to update their README.

ipaddress-gem/ipaddress#170

Man, I spent more time than I'd like to admit, trying to figure out where I went wrong, before realizing their README was wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Fix issue with IpAddress where to_s only return the ip address, and we need to_string

3 participants