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.
- checksums.yaml +4 -4
- data/README.md +42 -8
- data/lib/music_ids/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d075e77c1c9c168a277ebbe0f9c4cd56742f86eb
|
4
|
+
data.tar.gz: 9798bab45ac443c338230e84bad99fc3b3d4b102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
34
|
-
isrc.registrant
|
35
|
-
isrc.year
|
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
|
49
|
-
|
50
|
-
|
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 )
|
data/lib/music_ids/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|