pigeon_band 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -5
  3. data/lib/pigeon_band/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4f596ce451ea151bfec0ba842528aea903ccadd
4
- data.tar.gz: ce1bba537837b579f5cef50119921775cb7565a9
3
+ metadata.gz: 329a82fa6d394f74557065ad7154c96fc38acc8f
4
+ data.tar.gz: a57561986b972d95a7efd0b816c09c00b4dc8f9e
5
5
  SHA512:
6
- metadata.gz: 6fd01f51b0ced92e93d55681a87189be06fff73fdf7be902284f603bd25eaa448cbcc6c0cb9949f6b27c9bf54918534ba4f779af080edc4fe0dd8f57c2f19ca8
7
- data.tar.gz: d8ebbc5e12d7cc5df095f98b20a103931d8562c01d262f38ed174aa46b2b1a0b3e38637ce804c31659ad2e158a9d1f8a0f7d588a8c23007d0967f8529ac532d1
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 00 to 99
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
 
@@ -1,5 +1,5 @@
1
1
  module PigeonBand
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  COUNTRY = "DV"
4
4
  HOMEPAGE = "https://github.com/volkerwiegand/pigeon_band"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigeon_band
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand