ogg_album_tagger 0.0.3 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe085de677fda314335b3a9be3e9e1876babf625
4
- data.tar.gz: 4b4986dd6a57c93d6c06d0a35205201398b1d8a2
3
+ metadata.gz: cbafc73bba9ee1dd7d8b8e5ee7c041258f8a9461
4
+ data.tar.gz: b44bd48acb92454f074fdb2c61c912d81a29e3ea
5
5
  SHA512:
6
- metadata.gz: 5c1beb8dece8ac40a935ab4a59b30a9a85b0616ca35e5411a8dba7327f005f0a4dbd3d723613b4b81d43a478f690e40ef4e6b67a04b0a39f64536aea53d0de21
7
- data.tar.gz: d2e011cb35dd28482261da103e2fcb9270c7b0f294df4d78d31524728342bd8c1ba86560294370eb80bd6d336f9657c3d30b8d2699b615c419ec41c2a0e2b55c
6
+ metadata.gz: eafe6bc6b531c0c6d66b83ac632d837ef7ce7b2834ed678e9537f6ab7d3cce977c044413906b6e0b70882b1f60a88b5ff2bbf95f44349f724dcfde7a36000e89
7
+ data.tar.gz: 59dbd75622405bff1ebfc78eeb5163608f9bb8824c8778a304f261b5b03ec589e300c264d70af08409415bf01f29139cc0ddf616be298a2e7b7ef1cf1f99ee53
@@ -75,8 +75,14 @@ class TagContainer
75
75
  @hash.has_key?(tag.upcase)
76
76
  end
77
77
 
78
- # If the specified tag is absent from the container, associate an it to an empty Set.
78
+ # Check if the tag is valid, otherwise raise an ArgulentError.
79
+ def valid_tag? tag
80
+ raise ArgumentError, "Invalid tag." unless tag =~ /^[\x20-\x3C\x3E-\x7D]+$/
81
+ end
82
+
83
+ # If the specified tag is absent from the container, associate an empty Set to it.
79
84
  def prepare_tag tag
85
+ valid_tag? tag
80
86
  @hash[tag.upcase] = Set.new unless self.has_tag?(tag)
81
87
  end
82
88
 
@@ -95,6 +101,8 @@ class TagContainer
95
101
 
96
102
  # Remove some tags. If no value is specified, the specified tag is removed.
97
103
  def rm_values(tag, *values)
104
+ valid_tag? tag
105
+
98
106
  if values.empty? then @hash.delete(tag.upcase)
99
107
  else
100
108
  @hash[tag.upcase].subtract(values)
@@ -137,6 +145,7 @@ class TagContainer
137
145
  end
138
146
 
139
147
  private :prepare_tag
148
+ private :valid_tag?
140
149
  end
141
150
 
142
151
  end
@@ -1,3 +1,3 @@
1
1
  module OggAlbumTagger
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ogg_album_tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyrille Faucheux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-22 00:00:00.000000000 Z
11
+ date: 2015-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.2.2
103
+ rubygems_version: 2.4.6
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: Interactive edition of ogg tags with support for whole albums.