Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitbourahlavignal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIGNAL Nicolas
gitbourahlavignal
Commits
2edbae88
Commit
2edbae88
authored
7 years ago
by
Alan Somers
Committed by
Romain Tartière
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add IPv6#link_local?
parent
7f68225c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/ipaddress/ipv6.rb
+7
-0
7 additions, 0 deletions
lib/ipaddress/ipv6.rb
test/ipaddress/ipv6_test.rb
+6
-0
6 additions, 0 deletions
test/ipaddress/ipv6_test.rb
with
13 additions
and
0 deletions
lib/ipaddress/ipv6.rb
+
7
−
0
View file @
2edbae88
...
...
@@ -397,6 +397,13 @@ module IPAddress;
@compressed
end
#
# Returns true if the address is a link local address
#
def
link_local?
@groups
[
0
]
==
0xfe80
end
#
# Returns true if the address is an unspecified address
#
...
...
This diff is collapsed.
Click to expand it.
test/ipaddress/ipv6_test.rb
+
6
−
0
View file @
2edbae88
...
...
@@ -200,6 +200,12 @@ class IPv6Test < Minitest::Test
assert_equal
"1::1"
,
@klass
.
new
(
"1:0:0:0:0:0:0:1"
).
compressed
end
def
test_method_link_local?
assert_equal
true
,
@klass
.
new
(
"fe80::1"
).
link_local?
assert_equal
true
,
@klass
.
new
(
"fe80:ffff::1"
).
link_local?
assert_equal
false
,
@klass
.
new
(
"fe81::1"
).
link_local?
end
def
test_method_unspecified?
assert_equal
true
,
@klass
.
new
(
"::"
).
unspecified?
assert_equal
false
,
@ip
.
unspecified?
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment