music_ids 0.3.1 → 0.3.2

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 +42 -8
  3. data/lib/music_ids/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99fedf4553606e27aeca66af5e88e8cb2a025b37
4
- data.tar.gz: e9036104e3dc813a9381cceefcec0ffea8611246
3
+ metadata.gz: d075e77c1c9c168a277ebbe0f9c4cd56742f86eb
4
+ data.tar.gz: 9798bab45ac443c338230e84bad99fc3b3d4b102
5
5
  SHA512:
6
- metadata.gz: 1934b523cab56481e0be5d72a930be3617725ff7eb8291ba27e9b4836362eb7c404defc3399870b0bd02096aa8d9b43afbcd950fe2be11597018fd05000482d8
7
- data.tar.gz: e39e0d7a3ac778418ef2b70a1811784b94265d16a575903e54c39bb2184bd720c225f1f3d497aae722d6717c6b90469e37cf24e306d18bebd4f507b31a1cf1a4
6
+ metadata.gz: f46dcd3fb1756625c484f3b3eba6b525137a13a085f11fc2750745824c49ada705ca945e3bad4042b95c0a1de19c8bea17fa9319546566bd6d0d23245ada1359
7
+ data.tar.gz: 60c280f55d3515da25fe9eb878ff73040c65aaab86d70a716f8512b8aefc64e48c499477ce6fbb89a5405f8a69e79388afeadf2f608647624344ddfc66270277
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  There are often several ways that these IDs can be written, so the classes provide standard APIs to parse and normalise ID strings, as well as to break them into their components.
8
8
 
9
- Currently we offer a class for the ISRC (International Standard Recording Code).
9
+ Currently we have classes for the ISRC (International Standard Recording Code) and GRid (Global Release Identifier).
10
10
 
11
11
  ## Installation
12
12
  Add this line to your application's Gemfile:
@@ -24,15 +24,23 @@ Or install it yourself as:
24
24
  $ gem install music_ids
25
25
 
26
26
  ## Usage
27
- (See API docs at <http://www.rubydoc.info/gems/music_ids> for more details including links to the relevant ID specifications.)
27
+ (See API docs at <http://www.rubydoc.info/gems/music_ids> for more details
28
+ including links to the relevant ID specifications.)
29
+
30
+ `MusicIds::GRid` and `MusicIds::ISRC` have the same basic API pattern: a
31
+ `parse` class method, `to_s` returns normalised string version of the ID and
32
+ `as(format)` returns different string representations of the Id.
33
+
34
+ Instances compare equal if their normalised string representations match.
35
+ Parsing an existing instance just returns another instance of the same ID.
28
36
 
29
37
  ```ruby
30
38
  require 'music_ids'
31
39
 
32
40
  isrc = MusicIds::ISRC.parse('FRZ039800212')
33
- isrc.country #=> 'FR'
34
- isrc.registrant #=> 'Z03'
35
- isrc.year #=> '98'
41
+ isrc.country #=> 'FR'
42
+ isrc.registrant #=> 'Z03'
43
+ isrc.year #=> '98'
36
44
  isrc.designation #=> '00212'
37
45
 
38
46
  other = ISRC.parse('FR-Z03-98-00212')
@@ -42,12 +50,38 @@ isrc == other #=> true
42
50
 
43
51
  isrc.to_s #=> 'FRZ039800212'
44
52
  isrc.as(:full) #=> 'FR-Z03-98-00212'
53
+
54
+ MusicIds::ISRC.parse(isrc) == isrc #=> true
55
+
56
+ grid_with_hyphens = MusicIds::GRid.parse('A1-2425G-ABC1234002-M')
57
+ grid = MusicIds::GRid.parse('A12425GABC1234002M')
58
+ # You do see this form with GRids
59
+ grid_with_prefix = MusicIds::GRid.parse('GRID:A1-2425G-ABC1234002-M')
60
+
61
+ grid.scheme #=> 'A1'
62
+ grid.issuer #=> '2425G'
63
+ grid.release #=> 'ABC1234002'
64
+ grid.check #=> 'M'
65
+
66
+ grid_with_hyphens == grid #=> true
67
+ grid_with_prefix == grid #=> true
68
+
69
+ grid.to_s #=> 'A12425GABC1234002M'
70
+ grid.as(:full) #=> 'A1-2425G-ABC1234002-M'
71
+ grid.as(:prefixed) #=> 'GRID:A1-2425G-ABC1234002-M'
72
+
73
+ MusicIds::GRid.parse(grid) == grid #=> true
45
74
  ```
46
75
 
47
76
  ## Development
48
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
49
-
50
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
77
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
78
+ `bin/console` for an interactive prompt that will allow you to experiment.
79
+
80
+ To install this gem onto your local machine, run `bundle exec rake install`. To
81
+ release a new version, update the version number in `version.rb`, and then run
82
+ `bundle exec rake release` to create a git tag for the version, push git
83
+ commits and tags, and push the `.gem` file to
84
+ [rubygems.org](https://rubygems.org).
51
85
 
52
86
  ## Contributing
53
87
  1. Fork it ( https://github.com/[my-github-username]/music_ids/fork )
@@ -1,3 +1,3 @@
1
1
  module MusicIds
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: music_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Patterson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-10 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler