hwaddr 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/hwaddr-generate.rb +1 -1
- data/hwaddr.gemspec +1 -1
- data/lib/hwaddr.rb +15 -1
- metadata +2 -2
data/bin/hwaddr-generate.rb
CHANGED
@@ -15,7 +15,7 @@ until io.eof?
|
|
15
15
|
buf = ''
|
16
16
|
buf += io.readline while !io.eof? and buf !~ /\n{2}$/
|
17
17
|
|
18
|
-
if buf =~ /^(
|
18
|
+
if buf =~ /^(\h\h)-(\h\h)-(\h\h)\s+\(hex\)\s+(.+?)\n\1\2\3\s+\(base 16\)\s+\4\n(.*)$/m
|
19
19
|
cid, org, addr = "#$1:#$2:#$3", $4, $5.split(/\n/).map(&:strip).join("\n")
|
20
20
|
|
21
21
|
puts "HWAddr::Database.add(#{org.inspect}, #{cid.inspect}, #{addr.inspect})"
|
data/hwaddr.gemspec
CHANGED
data/lib/hwaddr.rb
CHANGED
@@ -12,7 +12,7 @@ class HWAddr
|
|
12
12
|
autoload :Database, 'hwaddr/database'
|
13
13
|
|
14
14
|
def self.valid? (text)
|
15
|
-
text =~ /^\
|
15
|
+
text =~ /^\h\h:\h\h:\h\h(?::\h\h:\h\h:\h\h)?$/
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize (value)
|
@@ -44,6 +44,16 @@ class HWAddr
|
|
44
44
|
@string.downcase!
|
45
45
|
end
|
46
46
|
|
47
|
+
def hash
|
48
|
+
to_s.hash
|
49
|
+
end
|
50
|
+
|
51
|
+
def == (other)
|
52
|
+
to_s == other.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
alias eql? ==
|
56
|
+
|
47
57
|
def =~ (other)
|
48
58
|
if group?
|
49
59
|
to_s == other.to_s[0, 8]
|
@@ -67,4 +77,8 @@ class HWAddr
|
|
67
77
|
def to_s
|
68
78
|
@string
|
69
79
|
end
|
80
|
+
|
81
|
+
def inspect
|
82
|
+
"#<HWAddr: #{to_s}>"
|
83
|
+
end
|
70
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hwaddr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: meh@paranoici.org
|