castle-log 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/castle/log/session.rb +19 -3
- data/lib/castle/log/version.rb +1 -1
- data/spec/session_spec.rb +11 -3
- 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: 4797c95bdb305b3595774e95cb3286113d71e2af
|
4
|
+
data.tar.gz: d026af6d58fc1eeee14c7b7a47e6fbf89ea7b159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05ec679d02eff9db2c667b0e24d57c3dfe912999f014dbdb5282731c371aa0c195cdb1ea53ad4f94c2fa3d883a8a3b52dc9398d0c31ba07ce3a312f00e96a7e9
|
7
|
+
data.tar.gz: b8deaf1e2c31d3983278df6382afccbadffdc2bdb642f51496f750cd64b8e8250bfe42998d9716813d6c9b6a1dac2a7cb186eafb0c26da0d284b1ac696090246
|
data/lib/castle/log/session.rb
CHANGED
@@ -21,6 +21,13 @@ module Castle
|
|
21
21
|
@duration ||= tick * @data.values[0].length
|
22
22
|
end
|
23
23
|
|
24
|
+
# Gets an array of millisecond times that correspond to data points.
|
25
|
+
#
|
26
|
+
# @return [Array] millisecond times corresponding to data points
|
27
|
+
def milliseconds
|
28
|
+
@milliseconds ||= build_milliseconds
|
29
|
+
end
|
30
|
+
|
24
31
|
def throttle?
|
25
32
|
present? 'Throttle'
|
26
33
|
end
|
@@ -74,13 +81,22 @@ module Castle
|
|
74
81
|
present? 'Speed'
|
75
82
|
end
|
76
83
|
|
77
|
-
|
78
|
-
|
79
|
-
|
84
|
+
# Gets the speed field values.
|
85
|
+
#
|
86
|
+
# @param [Float] factor value to multiply each speed by
|
87
|
+
# @return [Array] speed field values
|
88
|
+
def speed factor = 1.0
|
89
|
+
@speed ||= int_fields('Speed').map { |s| s * factor }
|
80
90
|
end
|
81
91
|
|
82
92
|
private
|
83
93
|
|
94
|
+
def build_milliseconds
|
95
|
+
count = @data.values[0].length
|
96
|
+
increment = tick * 1000.0
|
97
|
+
count.times.map { |i| i * increment }
|
98
|
+
end
|
99
|
+
|
84
100
|
def present? name
|
85
101
|
!@data[name].empty?
|
86
102
|
end
|
data/lib/castle/log/version.rb
CHANGED
data/spec/session_spec.rb
CHANGED
@@ -16,6 +16,14 @@ describe Castle::Log::Session do
|
|
16
16
|
|
17
17
|
its(:duration) { should be_within(0.1).of(569.2) }
|
18
18
|
|
19
|
+
its(:milliseconds) { should have(2846).values }
|
20
|
+
|
21
|
+
it 'should have some select millisecond values' do
|
22
|
+
subject.milliseconds[0].should eql(0.0)
|
23
|
+
subject.milliseconds[1500].should eql(300000.0)
|
24
|
+
subject.milliseconds[2602].should eql(520400.0)
|
25
|
+
end
|
26
|
+
|
19
27
|
its(:throttle?) { should be_true }
|
20
28
|
|
21
29
|
its(:throttle) { should have(2846).values }
|
@@ -81,9 +89,9 @@ describe Castle::Log::Session do
|
|
81
89
|
its(:speed) { should have(2846).values }
|
82
90
|
|
83
91
|
it 'should have some select speed values' do
|
84
|
-
subject.speed[0].should
|
85
|
-
subject.speed[1250].should
|
86
|
-
subject.speed[2150].should
|
92
|
+
subject.speed(0.02)[0].should be_within(0.01).of(0.0)
|
93
|
+
subject.speed(0.02)[1250].should be_within(0.01).of(1822.92)
|
94
|
+
subject.speed(0.02)[2150].should be_within(0.01).of(1687.32)
|
87
95
|
end
|
88
96
|
|
89
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: castle-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Veys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|