pla 0.1.0 → 0.1.1
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/README.md +10 -0
- data/lib/pla/movement.rb +3 -2
- data/lib/pla/movements.rb +1 -1
- data/pla.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 273a1bcd783512a908076b9d4bd1bda7547dd3c5
|
4
|
+
data.tar.gz: b48cfa6a31e46cbbaf9e8fdc4164d4f9598fea54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d74b7a88c34231e7503976af12ca9320c0476e0bb5f250455e5144092623157775a8972a5929ba76114f63745515050965c10cba7e3bb7f8a3a84781959ca4
|
7
|
+
data.tar.gz: bf9e30967ddbf7d42085d30bcc5c039096b96739ae4c3df87910f264fdb32721873f6b29fbdd14aff3d9c01de786f73ba8567fd98f81942ef37df95455ebd903
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[](https://badge.fury.io/rb/pla)
|
2
|
+
[](https://travis-ci.org/jspc/pla)
|
3
|
+
|
1
4
|
PLA
|
2
5
|
==
|
3
6
|
|
@@ -25,6 +28,13 @@ departures = PLA.departures
|
|
25
28
|
|
26
29
|
puts arrivals
|
27
30
|
puts departures
|
31
|
+
|
32
|
+
# Find next ten boats set to arrive
|
33
|
+
puts PLA.arrivals.sort_by{|a| a[:timestamp]}[0..9]
|
34
|
+
|
35
|
+
# Find all boats from Panama
|
36
|
+
puts PLA.arrivals.select{|b| b[:country] == 'Panama'}
|
37
|
+
|
28
38
|
```
|
29
39
|
|
30
40
|
Licence
|
data/lib/pla/movement.rb
CHANGED
@@ -36,12 +36,12 @@ class PLA
|
|
36
36
|
date = gen_date year+1, month, day, hour, minute
|
37
37
|
end
|
38
38
|
|
39
|
-
@record[
|
39
|
+
@record[:timestamp] = date
|
40
40
|
end
|
41
41
|
|
42
42
|
def normalise_ship!
|
43
43
|
name = @record.delete(:'vessel name')
|
44
|
-
@record[
|
44
|
+
@record[:vessel] = PLA::Ship.new(name).to_h
|
45
45
|
end
|
46
46
|
|
47
47
|
def normalise_country!
|
@@ -49,6 +49,7 @@ class PLA
|
|
49
49
|
begin
|
50
50
|
country = IsoCountryCodes.find(country_code).name
|
51
51
|
rescue IsoCountryCodes::UnknownCodeError
|
52
|
+
STDERR.puts "WARNING: Invalid country code #{country_code.upcase}"
|
52
53
|
country = country_code
|
53
54
|
end
|
54
55
|
|
data/lib/pla/movements.rb
CHANGED
@@ -34,7 +34,7 @@ class PLA
|
|
34
34
|
|
35
35
|
def set_headers
|
36
36
|
@headers = normalize_and_map(@ships.first.css('th'))
|
37
|
-
@headers[-1] = '
|
37
|
+
@headers[-1] = 'notes' # pla returns this as empty. We infer it means notes, though usually it says 'Pilot required'
|
38
38
|
end
|
39
39
|
|
40
40
|
def set_records
|
data/pla.gemspec
CHANGED