spektrum-log 0.0.10 → 0.0.11

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: dec4a1dd92edda247f52253077d7250e8c75ee85
4
- data.tar.gz: 2fb34f2061464fded588dad071da60f6e8ebfc85
3
+ metadata.gz: d12a83ac543c601321ea4e302f68675bac9fe13c
4
+ data.tar.gz: e92ea2f69badd802397c35324fc7167edc4907d5
5
5
  SHA512:
6
- metadata.gz: 962ebb95317415c1e7493fd3a9309f02019387fc5eb9858b61ef54177f6d279882c073b49367fa9e656e13e947b6ac774727d37dc2910818318accfee30c1944
7
- data.tar.gz: e1055ef8478a79ea14fc67a94d23a25c7e64142d398641609e4e6378deb6b156758b61a4a5ccb4d70bfbb458d7a64ad84ccbbe7825a53f5c076ee16856c95185
6
+ metadata.gz: 9fb5e5cad6d308a92031d7c2b90c77008eec37d401aa6f854f26eaac99510954fa9f7394eb0b9c8008e01578f59d52ae86bf1b19e0e23cc372713e94ef452bb0
7
+ data.tar.gz: 0d8c3a79b51fb6f9a38d8a0ddf391e61517e495adf433d295d9751bbb63937911c65cdf723d09650cc9a7d5133546f8ddce752dfd6a6203b3216990a6352ec48
@@ -47,7 +47,15 @@ module Spektrum
47
47
  end
48
48
  end
49
49
  end
50
+ rescue
51
+ raise ArgumentError, 'File does not appear to be an Spektrum log'
52
+ end
50
53
 
54
+ # Gets the total duration of all flights contained within.
55
+ #
56
+ # @return [Float] total duration of all flights, in seconds
57
+ def duration
58
+ @flights.map(&:duration).reduce(&:+)
51
59
  end
52
60
 
53
61
  end
@@ -1,5 +1,5 @@
1
1
  module Spektrum
2
2
  module Log
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -8,6 +8,8 @@ describe Spektrum::Log::Reader do
8
8
 
9
9
  it { should have(3).flights }
10
10
 
11
+ its(:duration) { should be_within(0.1).of(8.8) }
12
+
11
13
  end
12
14
 
13
15
  context 'data file 2.TLM' do
@@ -16,6 +18,8 @@ describe Spektrum::Log::Reader do
16
18
 
17
19
  it { should have(312).flights }
18
20
 
21
+ its(:duration) { should be_within(0.1).of(878.8) }
22
+
19
23
  end
20
24
 
21
25
  context 'data file 3.TLM' do
@@ -24,6 +28,8 @@ describe Spektrum::Log::Reader do
24
28
 
25
29
  it { should have(12).flights }
26
30
 
31
+ its(:duration) { should be_within(0.1).of(148.4) }
32
+
27
33
  end
28
34
 
29
35
  context 'data file 4.TLM' do
@@ -32,6 +38,8 @@ describe Spektrum::Log::Reader do
32
38
 
33
39
  it { should have(1).flights }
34
40
 
41
+ its(:duration) { should be_within(0.1).of(16.3) }
42
+
35
43
  end
36
44
 
37
45
  context 'data file GPS.TLM' do
@@ -40,10 +48,16 @@ describe Spektrum::Log::Reader do
40
48
 
41
49
  it { should have(2).flights }
42
50
 
51
+ its(:duration) { should be_within(0.1).of(366.4) }
52
+
43
53
  end
44
54
 
45
55
  it 'should raise on bad input' do
46
56
  expect { Spektrum::Log::Reader.new(__FILE__) }.to raise_error
47
57
  end
48
58
 
59
+ it 'should raise when file is not found' do
60
+ expect { Spektrum::Log::Reader.new(data_file('NOFILE.TLM')) }.to raise_error
61
+ end
62
+
49
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spektrum-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Veys