vnstat-ruby 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/vnstat/document.rb +8 -2
- data/lib/vnstat/interface_collection.rb +2 -1
- data/lib/vnstat/parser.rb +1 -1
- data/lib/vnstat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2214aef1d2fed1c199eb30e62fd0947193fb6f18
|
4
|
+
data.tar.gz: b5115aacbd68d2199faaec3bd2d7463ac10aaf97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33bc77a79debce5a520715e4676daea648f96cf5f2c8c2f977f1b2369dc2f85492bb19a7ddf6de88c00465cdc1f940fe8a082a24f5bdd756fbf8a070382a3947
|
7
|
+
data.tar.gz: 6fe044b316ac36c11654846e22c0fe94ac349f79eed7fd486461718632f00b42bdc1d1f3e292c1c024db82f246a51c6c94e1e8aeea28dbec41d01ad967d0d641
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/vnstat/document.rb
CHANGED
@@ -48,7 +48,10 @@ module Vnstat
|
|
48
48
|
#
|
49
49
|
# @return [String]
|
50
50
|
def version
|
51
|
-
data.xpath('vnstat').attr('version')
|
51
|
+
attr = data.xpath('vnstat').attr('version')
|
52
|
+
raise 'Unable to determine version' if attr.nil?
|
53
|
+
|
54
|
+
attr.text
|
52
55
|
end
|
53
56
|
|
54
57
|
##
|
@@ -56,7 +59,10 @@ module Vnstat
|
|
56
59
|
#
|
57
60
|
# @return [String]
|
58
61
|
def xml_version
|
59
|
-
data.xpath('vnstat').attr('xmlversion')
|
62
|
+
attr = data.xpath('vnstat').attr('xmlversion')
|
63
|
+
raise 'Unable to determine XML version' if attr.nil?
|
64
|
+
|
65
|
+
attr.text
|
60
66
|
end
|
61
67
|
end
|
62
68
|
end
|
@@ -98,9 +98,10 @@ module Vnstat
|
|
98
98
|
|
99
99
|
def interfaces_hash
|
100
100
|
@interfaces_hash ||= begin
|
101
|
+
id_attr = xml_version == '2' ? :name : :id
|
101
102
|
elements = data.xpath('//interface')
|
102
103
|
elements.each_with_object({}) do |node, hash|
|
103
|
-
id = node[
|
104
|
+
id = node[id_attr]
|
104
105
|
hash[id] = Interface.new(id, data)
|
105
106
|
end
|
106
107
|
end
|
data/lib/vnstat/parser.rb
CHANGED
@@ -33,7 +33,7 @@ module Vnstat
|
|
33
33
|
# Extracts the date and time from the given XML element.
|
34
34
|
#
|
35
35
|
# @param [Nokogiri::XML::Element] element The XML element.
|
36
|
-
# @return [
|
36
|
+
# @return [Time]
|
37
37
|
def extract_datetime_from_xml_element(element)
|
38
38
|
date = extract_date_from_xml_element(element)
|
39
39
|
hour = element.xpath('time/hour').text.to_i
|
data/lib/vnstat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vnstat-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Casper
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|