isbnranges 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0088879a30d7ca24baa9aeebee30204fc49531ae0dda60fed3a798f10edd9626'
4
- data.tar.gz: 37c9e8e915bc912ca093dbd7e96678a0e1da7a74ac2c07e702d2f844eb631ad1
3
+ metadata.gz: 7c21b32ff122bd1e46c7df587c130fe86d28a0d2da68e2c7ed6d6b045bb61c74
4
+ data.tar.gz: 60d9978dd4480e5631cce9ebd600dc56d3ceae46bd316b01de77c1b73ab8b6aa
5
5
  SHA512:
6
- metadata.gz: '097c8801591ddd1efc0af7f908ae3f787c2360fe9024568a56c5068a22d1d09516dcc5fe78231483cee78a39ad183fcc1e6d5ddd594219765962618f69855eae'
7
- data.tar.gz: '0940cadfc81880a4073ffe4723ed9b9cc82b54b030d56419183314225d9986542d29d3ae524d552afc221e35d816aa904001601ed688dbbb3716c08b2149671f'
6
+ metadata.gz: 51c93001c5bb43e2eadefa43d74fbb7a4c97775dd385947e0c81c6103ee1d5d2011011c9e5886314bfddec346b86ad4dfa4658358365d392fa0c3463f655bad1
7
+ data.tar.gz: 37779f2c820520e7e9745e8629d879109f18a659b315c919c60057bca890d1e98db20194702b1b65a6ef63f0efbe0664c74b0b3c184bedd13d670e91e7666679
data/README.md CHANGED
@@ -5,7 +5,7 @@ The range definitions of ISBN registration groups and registrants.
5
5
  This library provides programmer-friendly versions of data published by International ISBN Agency. It does NOT provide any manipulation of the data.
6
6
 
7
7
  All ranges of registration groups and registrants are supported.
8
- Those depends on 'RangeMessage.xml' file, downloaded from [International ISBN Agency](https://www.isbn-international.org/range_file_generation).
8
+ Those depend on 'RangeMessage.xml' file, downloaded from [International ISBN Agency](https://www.isbn-international.org/range_file_generation).
9
9
 
10
10
  ## Installation
11
11
 
@@ -24,11 +24,11 @@ After `require "isbnranges"`, you can refer to the following constants.
24
24
  - `ISBNRanges::REGISTRATION_GROUP_RANGES`
25
25
  - `ISBNRanges::REGISTRANT_RANGES`
26
26
 
27
- Both constants are HASHs with the prefix as the key. The value corresponding to the key is an Array of ranges defined under the prefix. Each range is a String whose beginning and end are joined by `-`, so it can be easily modified into a form that is convenient for you.
27
+ Both constants are Hash objects with the prefix as the key. The value corresponding to the key is an Array object of ranges defined under the prefix. Each range is an Array object whose beginning and end are included, so it can be easily modified into a form that is convenient for you.
28
28
 
29
29
  - `ISBNRanges::REGISTRATION_GROUP_AGENCY`
30
30
 
31
- This constant is also a HASH with the prefix as the key, and the corresponding value is the national agency name to which the prefix is assigned.
31
+ This constant is also a Hash object with the prefix as the key, and the corresponding value is the national agency name to which the prefix is assigned.
32
32
 
33
33
  - `ISBNRanges::RANGE_DATE`
34
34
 
@@ -38,10 +38,24 @@ This constant holds the defined date of the information contained in the range f
38
38
  => true
39
39
  irb(main):002:0> ISBNRanges::REGISTRATION_GROUP_RANGES
40
40
  =>
41
- {"978"=>["0-5", "600-649", "65-65", "7-7", "80-94", "950-989", "9900-9989", "99900-99999"],
42
- "979"=>["10-15", "8-8"]}
41
+ {"978"=>
42
+ [["0", "5"],
43
+ ["600", "649"],
44
+ ["65", "65"],
45
+ ["7", "7"],
46
+ ["80", "94"],
47
+ ["950", "989"],
48
+ ["9900", "9989"],
49
+ ["99900", "99999"]],
50
+ "979"=>[["10", "15"], ["8", "8"]]}
43
51
  irb(main):003:0> ISBNRanges::REGISTRANT_RANGES["978-4"]
44
- => ["00-19", "200-699", "7000-8499", "85000-89999", "900000-949999", "9500000-9999999"]
52
+ =>
53
+ [["00", "19"],
54
+ ["200", "699"],
55
+ ["7000", "8499"],
56
+ ["85000", "89999"],
57
+ ["900000", "949999"],
58
+ ["9500000", "9999999"]]
45
59
  irb(main):004:0> ISBNRanges::REGISTRATION_GROUP_AGENCY["978-4"]
46
60
  => "Japan"
47
61
  irb(main):005:0> ISBNRanges::RANGE_DATE
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ISBNRanges
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/isbnranges.rb CHANGED
@@ -17,7 +17,7 @@ module ISBNRanges
17
17
  f.each_line do |line|
18
18
  next if line.start_with?("#")
19
19
  g, r, a = line.chomp.split(":")
20
- ranges[g] = r.split(",") unless r.nil?
20
+ ranges[g] = r.split(",").map{|r| r.split("-")} unless r.nil?
21
21
  agencies[g] = a unless r.nil?
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isbnranges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - takatoh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-14 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: