kagu 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/VERSION +1 -1
- data/lib/kagu/track.rb +9 -1
- data/spec/kagu/track_spec.rb +14 -0
- 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: b924d298951b8a31fa4c0518deab9c81016440b2
|
4
|
+
data.tar.gz: 9658119eb3f372c711d8c280791c122468671e9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14e2a280b7cbab02c48532c716f6190e908875dd129eb51ec0d01b7b296afbd466ec5826adac01c8378747cb742f87ed855a18bbf0712993febc2f691c191ad7
|
7
|
+
data.tar.gz: 8ecd82e0a16cdf505e5320fc17e64a797c8d26815d10784d34e775f070da975937c2885919e62c05e703bef07876abc335d543a30c6aa0045530af10a895a2e6
|
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/kagu/track.rb
CHANGED
@@ -8,7 +8,7 @@ module Kagu
|
|
8
8
|
MANDATORY_ATTRIBUTES = %w(added_at id length path)
|
9
9
|
IS_MAC_OS = RUBY_PLATFORM =~ /darwin/
|
10
10
|
|
11
|
-
attr_reader :added_at, :album, :artist, :genre, :id, :length, :path, :title, :year
|
11
|
+
attr_reader :added_at, :album, :artist, :bpm, :genre, :id, :length, :path, :title, :year
|
12
12
|
|
13
13
|
def initialize(attributes = {})
|
14
14
|
super
|
@@ -53,6 +53,10 @@ module Kagu
|
|
53
53
|
@artist = value.to_s.squish.presence
|
54
54
|
end
|
55
55
|
|
56
|
+
def bpm=(value)
|
57
|
+
@bpm = value.to_s =~ /\A[0-9]+\z/ ? value.to_i : nil
|
58
|
+
end
|
59
|
+
|
56
60
|
def genre=(value)
|
57
61
|
@genre = value.to_s.squish.presence
|
58
62
|
end
|
@@ -74,6 +78,10 @@ module Kagu
|
|
74
78
|
self.artist = html_entities_decode(value)
|
75
79
|
end
|
76
80
|
|
81
|
+
def itunes_bpm=(value)
|
82
|
+
self.bpm = value
|
83
|
+
end
|
84
|
+
|
77
85
|
def itunes_date_added=(value)
|
78
86
|
self.added_at = value.present? ? Time.parse(value.to_s) : nil
|
79
87
|
end
|
data/spec/kagu/track_spec.rb
CHANGED
@@ -108,6 +108,20 @@ describe Kagu::Track do
|
|
108
108
|
|
109
109
|
end
|
110
110
|
|
111
|
+
describe '#bpm' do
|
112
|
+
|
113
|
+
it 'is nil if invalid' do
|
114
|
+
track.send(:bpm=, "42a")
|
115
|
+
expect(track.bpm).to be_nil
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'is an integer' do
|
119
|
+
track.send(:bpm=, '143')
|
120
|
+
expect(track.bpm).to be(143)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
111
125
|
describe '#eql?' do
|
112
126
|
|
113
127
|
it 'is true for same object' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kagu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|