macaddr-steakknife 1.8.5 → 1.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afaccb364887b2c6d698da894708584a7ce28bc6
4
- data.tar.gz: e5166ed7ff227a37078a7e76330688d5ba552c27
3
+ metadata.gz: c57cbf6a8fbd425c5474e8e958b5dcea95802ee7
4
+ data.tar.gz: 2e56b45828bd7a85a3a9eda3be164dea4a08b349
5
5
  SHA512:
6
- metadata.gz: 3c890cdf2541f413e94e114d03882991e1f9a2ef8fd705af8670fc7ab7705ec82c77a9ea143c0310fc4061ffbb9f5d575e95e75161cb7be56b62a916b10c199f
7
- data.tar.gz: d9588c2d0acf362cc6352e98a8d9d7439f4759740ef622c3f2389e91c0139720fe75fe70384a874cec0a500db4d1a9be80a2cf6e90a80661c2bbce6e1231559e
6
+ metadata.gz: ce447a031629700c73c79c65c4cd5c55b570eb8c10524dcb9870c8793af458d0d87b780373773fc3e5436127ed34b1d8332b0a5602dd80ca912d1a2c22e6d8b3
7
+ data.tar.gz: 0fb9a3c0378464c8a98dd6d458b31ce4cf61482bac75b6c275fbc1ed52a75b548cc4ea53f33aa04ca6532f7e91dee4a307238e14a02cf953ab083dd1ede1f617
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/macaddr.rb CHANGED
@@ -112,15 +112,15 @@ module Mac
112
112
  .scan(LOOSE_MAC_REGEX) # mac address(es)
113
113
  end
114
114
 
115
- def from_ifconfig
115
+ def from_cmd(cmd, name_regex, mac_regex=nil)
116
116
  name = nil
117
- %x{ifconfig}
117
+ %x{#{cmd}}
118
118
  .split(/\n/)
119
119
  .collect do |line|
120
- if line =~ /\A([^:\s]+):.*\z/
120
+ if line =~ name_regex
121
121
  name = clean($1)
122
122
  nil
123
- elsif line =~ /(?:ether|HWaddr)\s+/
123
+ elsif mac_regex.nil? || line =~ mac_regex
124
124
  mac = filter_mac(line)
125
125
  [name, mac.first] if !name.nil? && !mac.empty?
126
126
  end
@@ -128,20 +128,12 @@ module Mac
128
128
  .compact
129
129
  end
130
130
 
131
+ def from_ifconfig
132
+ from_cmd('ifconfig', /\A([^:\s]+):.*\z/, /(?:ether|HWaddr)\s+/)
133
+ end
134
+
131
135
  def from_ipconfig
132
- name = nil
133
- %x{ipconfig /all}
134
- .split(/\n/)
135
- .collect do |line|
136
- if line =~ /\A[^:]+\s*adapter\s*([^:]+):\z/
137
- name = clean($1)
138
- nil
139
- else
140
- mac = filter_mac(line)
141
- [name, mac.first] if !name.nil? && !mac.empty?
142
- end
143
- end
144
- .compact
136
+ from_cmd('ipconfig /all', /\A[^:]+\s*adapter\s*([^:]+):\z/)
145
137
  end
146
138
 
147
139
  def from_getnameinfo
@@ -1,3 +1,3 @@
1
1
  module MacAddr
2
- VERSION = "1.8.5".freeze
2
+ VERSION = "1.8.6".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macaddr-steakknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.5
4
+ version: 1.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
metadata.gz.sig CHANGED
Binary file