bindata-contrib 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bindata-contrib.rb +3 -0
- data/lib/ipv4_address.rb +14 -0
- data/lib/ipv6_address.rb +14 -0
- data/lib/mac_address.rb +14 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ff9df3a36760b71ea916558e41c34039d787a7
|
4
|
+
data.tar.gz: 331a505e228bd5b26e0ec820c96e6b73239a2c5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d8dfa470db358f55bb0510c140e2051a50de7bc8a603b870e2ed68902278492967ca4bd96fa921e4d7db8eab5973b1d08acf8422f9ad3d0d7124a812deb7a48
|
7
|
+
data.tar.gz: fd051a5cc275a742693dedf37330ef11c1b556a7965e3d5ca894008f87a531b79e41d0c3c0fd4218433687fbb8b62e69c8314207ac23bc57219f3f37841d1056
|
data/lib/bindata-contrib.rb
CHANGED
data/lib/ipv4_address.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bindata'
|
2
|
+
|
3
|
+
class Ipv4Address < BinData::Primitive
|
4
|
+
endian :big
|
5
|
+
array :octets, type: :uint8, initial_length: 4
|
6
|
+
|
7
|
+
def get
|
8
|
+
octets.map(&:to_s).join('.')
|
9
|
+
end
|
10
|
+
|
11
|
+
def set(value)
|
12
|
+
self.octets = value.split('.').map(&:to_i)
|
13
|
+
end
|
14
|
+
end
|
data/lib/ipv6_address.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bindata'
|
2
|
+
|
3
|
+
class Ipv6Address < BinData::Primitive
|
4
|
+
endian :big
|
5
|
+
array :octets, type: :uint8, initial_length: 16
|
6
|
+
|
7
|
+
def get
|
8
|
+
octets.map { |o| o.to_s(16) }.join(':')
|
9
|
+
end
|
10
|
+
|
11
|
+
def set(value)
|
12
|
+
self.octets = value.split(':').map { |o| o.to_i(16) }
|
13
|
+
end
|
14
|
+
end
|
data/lib/mac_address.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bindata'
|
2
|
+
|
3
|
+
class MacAddress < BinData::Primitive
|
4
|
+
endian :big
|
5
|
+
array :octets, type: :uint8, initial_length: 6
|
6
|
+
|
7
|
+
def get
|
8
|
+
octets.map { |octet| format('%02x', octet) }.join(':')
|
9
|
+
end
|
10
|
+
|
11
|
+
def set(value)
|
12
|
+
self.octets = value.split(':').map(&:hex)
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bindata-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérémy Pagé
|
@@ -21,6 +21,9 @@ files:
|
|
21
21
|
- lib/bool.rb
|
22
22
|
- lib/enum.rb
|
23
23
|
- lib/flags.rb
|
24
|
+
- lib/ipv4_address.rb
|
25
|
+
- lib/ipv6_address.rb
|
26
|
+
- lib/mac_address.rb
|
24
27
|
homepage: https://github.com/jejepage/bindata-contrib
|
25
28
|
licenses:
|
26
29
|
- MIT
|
@@ -44,5 +47,5 @@ rubyforge_project:
|
|
44
47
|
rubygems_version: 2.4.8
|
45
48
|
signing_key:
|
46
49
|
specification_version: 4
|
47
|
-
summary: BinData
|
50
|
+
summary: BinData Contrib
|
48
51
|
test_files: []
|