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

Define #succ and #pred methods #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

raorn
Copy link

@raorn raorn commented Sep 8, 2016

Example:

ip = IPAddress("192.168.45.23/16")

ip.pred.to_string
=> "192.168.45.22/16"

ip6 = IPAddress("2001:db8::8:800:200c:417a/64")

ip6.succ.to_string
=> "2001:db8::8:800:200c:417b/64"

This allows to use IPAddress objects in Range:

range = IPAddress("192.168.1.15")..IPAddress("192.168.45.80")

range.include IPAddress("192.168.22.47")
=> true

range.include IPAddress("192.168.0.3")
=> false

Signed-off-by: Alexey I. Froloff [email protected]

Example:

  ip = IPAddress("192.168.45.23/16")

  ip.pred.to_string
    => "192.168.45.22/16"

  ip6 = IPAddress("2001:db8::8:800:200c:417a/64")

  ip6.succ.to_string
    => "2001:db8::8:800:200c:417b/64"

This allows to use IPAddress objects in Range:

  range = IPAddress("192.168.1.15")..IPAddress("192.168.45.80")

  range.include IPAddress("192.168.22.47")
    => true

  range.include IPAddress("192.168.0.3")
    => false

Signed-off-by: Alexey I. Froloff <[email protected]>
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.

1 participant