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

Changing octets doesn't change address #24

Closed
realloc opened this issue Aug 27, 2012 · 2 comments · Fixed by #61
Closed

Changing octets doesn't change address #24

realloc opened this issue Aug 27, 2012 · 2 comments · Fixed by #61
Assignees

Comments

@realloc
Copy link

realloc commented Aug 27, 2012

When I change a value in .octets I expect the .address to be changes. Than doesn't occur.
Version 0.8.0 is used.

realloc@support01:/var/tmp$ irb
1.9.3-p194 :001 > require 'ipaddress'
 => true 
1.9.3-p194 :002 > ip = IPAddress("172.16.10.1/24")
 => 172.16.10.1 
1.9.3-p194 :003 > ip.address
 => "172.16.10.1" 
1.9.3-p194 :004 > ip.octets[2]=11
 => 11 
1.9.3-p194 :005 > ip.address
 => "172.16.10.1" 
1.9.3-p194 :006 > ip[2]
 => 11 
1.9.3-p194 :007 > 
@mikemackintosh
Copy link
Collaborator

I think this is a legit concern, and causes confusion if you can read an octet or group using [], but cannot write. As of 0.8.1, a IPv4/6#[]= method didn't exist.

I have added this to both classes, IPv4 and IPv6, and will be including it into 0.8.2

mikemackintosh added a commit to mikemackintosh/ipaddress that referenced this issue Mar 23, 2015
mikemackintosh added a commit to mikemackintosh/ipaddress that referenced this issue Mar 23, 2015
@mikemackintosh mikemackintosh self-assigned this Mar 26, 2015
@mikemackintosh
Copy link
Collaborator

This has been included here - #61

valtri added a commit to valtri/NOW that referenced this issue Nov 29, 2016
There is used []= operation on IPv4 address (ipaddress-gem/ipaddress#24).
TheHolyRoger pushed a commit to whatagem/ipaddress that referenced this issue Oct 18, 2021
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 a pull request may close this issue.

2 participants