egauge 1.0.2 → 1.0.3
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/History.txt +5 -1
- data/Version.txt +1 -1
- data/lib/egauge/data.rb +5 -5
- data/lib/egauge/register.rb +4 -4
- data/spec/egauge/data_spec.rb +1 -2
- data/spec/egauge/register_spec.rb +1 -2
- metadata +2 -2
data/History.txt
CHANGED
data/Version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/lib/egauge/data.rb
CHANGED
@@ -51,7 +51,7 @@ module EGauge
|
|
51
51
|
end.inject(&:+)
|
52
52
|
end
|
53
53
|
|
54
|
-
# Run each
|
54
|
+
# Run each row in the dataset, yielding |timestamp, [register vals...]|
|
55
55
|
def each_row
|
56
56
|
@xml.group.elements.each do |chunk|
|
57
57
|
# Set up for running this data chunk - prep timestamp and increment step from source xml
|
@@ -61,17 +61,17 @@ module EGauge
|
|
61
61
|
# Run each row in the chunk, and yield our results
|
62
62
|
(chunk / './r').each do |row|
|
63
63
|
vals = (row / './c').collect {|c| c.text.to_i}
|
64
|
-
yield ts, vals
|
64
|
+
yield ts, vals
|
65
65
|
ts += step
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
# Return results as a 2D array, like so: [ [timestamp1, [val1, val2...]
|
70
|
+
# Return results as a 2D array, like so: [ [timestamp1, [val1, val2...]], [timestamp2, [val1, val2,...]], ... ]
|
71
71
|
def to_a
|
72
72
|
res = []
|
73
|
-
each_row do |ts, vals
|
74
|
-
res << [ts, vals
|
73
|
+
each_row do |ts, vals|
|
74
|
+
res << [ts, vals]
|
75
75
|
end
|
76
76
|
res
|
77
77
|
end
|
data/lib/egauge/register.rb
CHANGED
@@ -23,17 +23,17 @@ module EGauge
|
|
23
23
|
# Run each row in the chunk, and yield our results
|
24
24
|
(chunk / './r').each do |row|
|
25
25
|
val = (row / './c')[@index].text.to_i
|
26
|
-
yield ts, val
|
26
|
+
yield ts, val
|
27
27
|
ts += step
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
# Return results as a 2D array, like so: [ [timestamp1, val1
|
32
|
+
# Return results as a 2D array, like so: [ [timestamp1, val1], [timestamp2, val2], ... ]
|
33
33
|
def to_a
|
34
34
|
res = []
|
35
|
-
each_row do |ts, val
|
36
|
-
res << [ts, val
|
35
|
+
each_row do |ts, val|
|
36
|
+
res << [ts, val]
|
37
37
|
end
|
38
38
|
res
|
39
39
|
end
|
data/spec/egauge/data_spec.rb
CHANGED
@@ -35,11 +35,10 @@ describe EGauge::Data do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should allow access to full row data' do
|
38
|
-
@data1.each_row do |ts, values
|
38
|
+
@data1.each_row do |ts, values|
|
39
39
|
ts.should be_a(Time)
|
40
40
|
values.should be_a(Array)
|
41
41
|
values.count.should == 3
|
42
|
-
step.should == 60
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
@@ -24,10 +24,9 @@ describe EGauge::Register do
|
|
24
24
|
|
25
25
|
it 'should allow iterating over values with timestamps' do
|
26
26
|
counter = 0
|
27
|
-
@reg.each_row do |ts, val
|
27
|
+
@reg.each_row do |ts, val|
|
28
28
|
val.should be_a(Integer)
|
29
29
|
ts.should be_a(Time)
|
30
|
-
step.should == 60
|
31
30
|
counter += 1
|
32
31
|
end
|
33
32
|
counter.should == 3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egauge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
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-11-
|
12
|
+
date: 2012-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|