metal_archives 3.1.0 → 3.1.1

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: cc72b807bbb20dcb70cfc38a6808b1088a3c5a187a6b033f82ef0083e5ff7794
4
- data.tar.gz: b2424b28220556afc3c777efcd38e10f9b03d92d58905130e53723a0f5e5691c
3
+ metadata.gz: 39ec01fd7f1c69fc54d794cd58693912fd4c1ece0ca6f70c4281ba3b3d7cad4c
4
+ data.tar.gz: d518c8a15a0e5a9fbb26565696aeead06435a06f12dafcd586b54a4c50be5f3e
5
5
  SHA512:
6
- metadata.gz: 5d80a6bf547b425d5d85c1b789e62a9224cf77e06911e8e8e45f298041778e2b9e976e754fc1a6f43a939e2e5b5cabf581f7b43b8677d8d48f4023a11df516fb
7
- data.tar.gz: 2911d68d5725d92def587f482cc01235c280e7989b1903cac2374632136e667f988384141ffbb2ae9c69bae95a555c7f7cac50e96e12af273e562bc372bb141c
6
+ metadata.gz: 15cf3a9ae549ff1a43aae068a83b16287c7a70ad95ee176e41dbccac78fe0884031bfff6ec1a4cdda098b7dcbcc7b720b1087cfd9fa3a6da39a766b805321720
7
+ data.tar.gz: f4738548bd36c4af3e97e6a666df23861a3a2bc969a1148d66fccf9cd2d404593f1fb77b3a63a61fa9f1a0325dd754173a7763424653c271abdbefcf201f2817
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.1
4
+
5
+ - Fix some invalid parsing
6
+
3
7
  ## 3.1.0
4
8
 
5
9
  - Add members property on band
@@ -251,7 +251,7 @@ module MetalArchives
251
251
  # +Integer+
252
252
  #
253
253
  def find(id)
254
- return MetalArchives.cache[id] if MetalArchives.cache.include? id
254
+ return MetalArchives.cache[cache(id)] if MetalArchives.cache.include? cache(id)
255
255
 
256
256
  Artist.new id: id
257
257
  end
@@ -277,7 +277,7 @@ module MetalArchives
277
277
  # +Integer+
278
278
  #
279
279
  def find(id)
280
- return MetalArchives.cache[id] if MetalArchives.cache.include? id
280
+ return MetalArchives.cache[cache(id)] if MetalArchives.cache.include? cache(id)
281
281
 
282
282
  Band.new id: id
283
283
  end
@@ -43,10 +43,10 @@ module MetalArchives
43
43
  set(**assemble)
44
44
 
45
45
  @loaded = true
46
- MetalArchives.cache[id] = self
46
+ MetalArchives.cache[self.class.cache(id)] = self
47
47
  rescue StandardError => e
48
48
  # Don't cache invalid requests
49
- MetalArchives.cache.delete id
49
+ MetalArchives.cache.delete self.class.cache(id)
50
50
  raise e
51
51
  end
52
52
 
@@ -61,7 +61,7 @@ module MetalArchives
61
61
  # Whether or not the object is currently cached
62
62
  #
63
63
  def cached?
64
- loaded? && MetalArchives.cache.include?(id)
64
+ loaded? && MetalArchives.cache.include?(self.class.cache(id))
65
65
  end
66
66
 
67
67
  ##
@@ -94,6 +94,13 @@ module MetalArchives
94
94
  @properties ||= {}
95
95
  end
96
96
 
97
+ ##
98
+ # Generate cache key for id
99
+ #
100
+ def cache(id)
101
+ "#{self.class.name}//#{id}"
102
+ end
103
+
97
104
  protected
98
105
 
99
106
  ##
@@ -139,7 +139,7 @@ module MetalArchives
139
139
  # +Integer+
140
140
  #
141
141
  def find(id)
142
- return MetalArchives.cache[id] if MetalArchives.cache.include? id
142
+ return MetalArchives.cache[cache(id)] if MetalArchives.cache.include? cache(id)
143
143
 
144
144
  Release.new id: id
145
145
  end
@@ -115,7 +115,7 @@ module MetalArchives
115
115
  r = row.css(".member_in_band_role")
116
116
 
117
117
  range = Parsers::Year.parse(r.xpath("text()").map(&:content).join.strip.gsub(/[\n\r\t]/, "").gsub(/.*\((.*)\)/, '\1'))
118
- role = sanitize r.css("strong").first.content
118
+ role = sanitize r.css("strong")&.first&.content
119
119
 
120
120
  {
121
121
  id: id,
@@ -144,7 +144,7 @@ module MetalArchives
144
144
  end
145
145
 
146
146
  r = row.css("td").last.text
147
- role, range = r.match(/(.*)\(([^(]*)\)/).captures
147
+ role, range = r.match(/(.*)\(([^(]*)\)/)&.captures
148
148
 
149
149
  range = Parsers::Year.parse(range)
150
150
 
@@ -25,7 +25,7 @@ module MetalArchives
25
25
  def self.parse(input)
26
26
  genres = []
27
27
  # Split fields
28
- input.split(",").each do |genre|
28
+ input.split(/[,;]/).each do |genre|
29
29
  ##
30
30
  # Start with a single empty genre string. Split the genre by spaces
31
31
  # and process each component. If a component does not have a slash,
@@ -15,6 +15,8 @@ module MetalArchives
15
15
  # Return +String+
16
16
  #
17
17
  def sanitize(input)
18
+ return if input.blank?
19
+
18
20
  input
19
21
  .gsub(/^"/, "")
20
22
  .gsub(/"$/, "")
@@ -12,6 +12,8 @@ module MetalArchives
12
12
  # Returns +Range+ of +Integer+
13
13
  #
14
14
  def self.parse(input)
15
+ return if input.blank?
16
+
15
17
  components = input
16
18
  .split("-")
17
19
  .map(&:to_i)
@@ -7,7 +7,7 @@ module MetalArchives
7
7
  module Version
8
8
  MAJOR = 3
9
9
  MINOR = 1
10
- PATCH = 0
10
+ PATCH = 1
11
11
  PRE = nil
12
12
 
13
13
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metal_archives
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dejonckheere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: countries