castle-log 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9c7b4009e9b5875b1d66fadc760aed5d6e1b621
4
- data.tar.gz: 53522822f42bde658e2d98f37d4328a48b2d67ef
3
+ metadata.gz: c2ba7b79b2070c5297a6378a7c89303b2e601d7c
4
+ data.tar.gz: 6026608e14f7660181a5d3692dd397700a4e3ce2
5
5
  SHA512:
6
- metadata.gz: 2ef998e9d21f2d28aa0f7eed12449a1634ec507f37685e9a85f9571d1f16a30910cc3a6ab1eef90847f62b140a6896ee8d60ac8356c44f313bf4b7b3c72cf016
7
- data.tar.gz: 7e08bba344072a02af02fb8a44461da64837c005381d546d4af7577a21a2a05eacc166528ba6378b650853794fe32e829ad53aebd732adaee4ccce4e2e4b4cce
6
+ metadata.gz: 2b80a763bba60ce8ecb986f10d64f43e9243e33d679e8cfec5b736dc4f27b4c1ac64e2071ed9792d174962761a23e3b5851864e0ddf19960f363079a9594b935
7
+ data.tar.gz: 669e0d9875a5d59a0da89d7e32e2a9b13c81a8250448ba7fb1671f3351fe18e90bdce76d44f6587e03e374cec3dbbd6c90069f087f276b9d3aff5a843b110823
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -58,6 +58,13 @@ module Castle
58
58
  raise ArgumentError, 'File does not appear to be an Castle data log'
59
59
  end
60
60
 
61
+ # Gets the total duration of all sessions contained within.
62
+ #
63
+ # @return [Float] total duration of all sessions, in seconds
64
+ def duration
65
+ @sessions.map(&:duration).reduce(&:+)
66
+ end
67
+
61
68
  private
62
69
 
63
70
  def extract_sessions line_hash
@@ -70,8 +77,6 @@ module Castle
70
77
  tick = /Sample Time: (?<tick>\d+.\d+)/.match(start[0])[:tick].strip.to_f
71
78
  source = /\(Cause of reset\): (?<source>.*)/.match(reset[0])[:source].strip
72
79
 
73
- # XXX can we use CSV for this instead?
74
-
75
80
  # strip out comment rows
76
81
  raw_rows = lines.reject { |line| line.start_with?('#') }
77
82
 
@@ -14,6 +14,9 @@ module Castle
14
14
  @data = data
15
15
  end
16
16
 
17
+ # Gets the duration of the session, in seconds.
18
+ #
19
+ # @return [Float] duration of the session, in seconds
17
20
  def duration
18
21
  @duration ||= tick * @data.values[0].length
19
22
  end
@@ -1,5 +1,5 @@
1
1
  module Castle
2
2
  module Log
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
- Skywalker
2
- 0 0 0 255 1 0 0 0 255 1 254 0 0 1 0 0 0 255 0 0 0 1 0 74 1536 10.04 536588 0 262228
3
- All Sessions
4
- 0 0
5
- Milliseconds IsEvent EventError EventData Altitude Airspeed ServoCurrent*100 Throttle PackVolt*100 Amps*100 GForceX*100 GForceY*100 GForceZ*100 Temp1*10 Temp2*10 Temp3*10 RPM RPM2 GPSLat GPSLon GPSAlt GPSSpeed GPSCourse GPSDist GPSUTC NumSats GPSFlags SpektrumHolds SpektrumLostFrames SpektrumAFades SpektrumBFades SpektrumLeftFades SpektrumRightFades GPSUTC-ASCII HDOP*10
1
+ Skywalker
2
+ 0 0 0 255 1 0 0 0 255 1 254 0 0 1 0 0 0 255 0 0 0 1 0 74 1536 10.04 536588 0 262228
3
+ All Sessions
4
+ 0 0
5
+ Milliseconds IsEvent EventError EventData Altitude Airspeed ServoCurrent*100 Throttle PackVolt*100 Amps*100 GForceX*100 GForceY*100 GForceZ*100 Temp1*10 Temp2*10 Temp3*10 RPM RPM2 GPSLat GPSLon GPSAlt GPSSpeed GPSCourse GPSDist GPSUTC NumSats GPSFlags SpektrumHolds SpektrumLostFrames SpektrumAFades SpektrumBFades SpektrumLeftFades SpektrumRightFades GPSUTC-ASCII HDOP*10