summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Mackintosh <m@zyp.io>2015-03-23 17:15:49 -0400
committerMike Mackintosh <m@zyp.io>2015-03-23 17:15:49 -0400
commit89cc3cc8f71cb3fe823698e4d71c27f98d26c01d (patch)
tree9f23929cff46f9cd4c2fb0aec8339665051cef95 /lib
parentad087f8fac02c9de49ef78263a376d20e442ac2a (diff)
downloadipaddress-89cc3cc8f71cb3fe823698e4d71c27f98d26c01d.tar.gz
added IPv6#[]= to fix #24
Diffstat (limited to 'lib')
-rw-r--r--lib/ipaddress/ipv6.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ipaddress/ipv6.rb b/lib/ipaddress/ipv6.rb
index 33d4d19..88098bc 100644
--- a/lib/ipaddress/ipv6.rb
+++ b/lib/ipaddress/ipv6.rb
@@ -252,6 +252,15 @@ module IPAddress;
end
alias_method :group, :[]
+ #
+ # Updated the octet specified at index
+ #
+ def []=(index, value)
+ @groups[index] = value
+ initialize("#{IN6FORMAT % @groups}/#{prefix}")
+ end
+ alias_method :group=, :[]=
+
#
# Returns a Base16 number representing the IPv6
# address