pigeon_band 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.
- checksums.yaml +4 -4
- data/README.md +30 -5
- data/lib/pigeon_band/version.rb +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: 329a82fa6d394f74557065ad7154c96fc38acc8f
|
4
|
+
data.tar.gz: a57561986b972d95a7efd0b816c09c00b4dc8f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31b2b4ca7de3a0c46289cef34b78397768f2e213808a58a23cc2f3daec877424c5674acb641996c20fbe90416cad6dd4f4da60458f112aa91c9e26862f40b250
|
7
|
+
data.tar.gz: 73a92ec6e916e092cf304a9bedcb8d4970389dc6a64231c6831dabeb7173ba73ba9b2297425a5c0ca42d03505cea62d28aadb198a93a9bdd85a4d2788815c461
|
data/README.md
CHANGED
@@ -32,6 +32,10 @@ Or install it yourself as:
|
|
32
32
|
After loading the pigeon_band gem, there is a new object PigeonBand with one method #format.
|
33
33
|
Given a band as a string, it returns a hash consisting of five fields.
|
34
34
|
|
35
|
+
Please note that the input is normalized before being scanned. Any '/' (slash), '.' (dot),
|
36
|
+
'-' (dash) or ' ' (space) is converted to a '-' (dash). If the input does nor start with a letter
|
37
|
+
a default of DV is added. Alternatively, a second argument can be added to calling #format.
|
38
|
+
|
35
39
|
* band
|
36
40
|
* The normalized band as it should be displayed
|
37
41
|
* coll
|
@@ -51,6 +55,21 @@ PigeonBand.format("DV-06914-12-479")
|
|
51
55
|
|
52
56
|
PigeonBand.format("DV-099-09-850")
|
53
57
|
{ band: "DV-099-09-850", coll: "DV-00099-09-0850", year: 2009, code: "DE", error: nil }
|
58
|
+
|
59
|
+
PigeonBand.format("B-08-2148152")
|
60
|
+
{ band: "B-08-2148152", coll: "B-08-2148152", year: 2008, code: "BE", error: nil }
|
61
|
+
|
62
|
+
PigeonBand.format("8.2148152", "B")
|
63
|
+
{ band: "B-08-2148152", coll: "B-08-2148152", year: 2008, code: "BE", error: nil }
|
64
|
+
|
65
|
+
PigeonBand.format("1 1 1")
|
66
|
+
{ band: "DV-01-01-1", coll: "DV-00001-01-0001", year: 201, code: "DE", error: nil }
|
67
|
+
|
68
|
+
PigeonBand.format("")
|
69
|
+
{ band: nil, coll: nil, year: nil, code: nil, error: "input_missing" }
|
70
|
+
|
71
|
+
PigeonBand.format("XX-1")
|
72
|
+
{ band: nil, coll: nil, year: nil, code: nil, error: "country_unknown" }
|
54
73
|
```
|
55
74
|
|
56
75
|
## Error messages
|
@@ -65,20 +84,26 @@ The following error messages are sent when the corresponding error is detected:
|
|
65
84
|
* You can help improving this gem by contributing it :-)
|
66
85
|
* See below for details.
|
67
86
|
|
87
|
+
* year_missing
|
88
|
+
* The year is missing for this country.
|
89
|
+
|
90
|
+
* year_invalid
|
91
|
+
* The year is invalid (i.e. not a number).
|
92
|
+
|
68
93
|
* year_range
|
69
|
-
* The given year is outside the valid range of
|
94
|
+
* The given year is outside the valid range of 0 to 99.
|
70
95
|
|
71
96
|
* club_below
|
72
|
-
* The given club (for countries with club numbers) is too low
|
97
|
+
* The given club (for countries with club numbers) is too low.
|
73
98
|
|
74
99
|
* club_above
|
75
|
-
* The given club (for countries with club numbers) is too high
|
100
|
+
* The given club (for countries with club numbers) is too high.
|
76
101
|
|
77
102
|
* sequ_below
|
78
|
-
* The given running number is too low
|
103
|
+
* The given running number is too low.
|
79
104
|
|
80
105
|
* sequ_above
|
81
|
-
* The given running number is too high
|
106
|
+
* The given running number is too high.
|
82
107
|
|
83
108
|
## Complete Rails example
|
84
109
|
|
data/lib/pigeon_band/version.rb
CHANGED