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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 721d1c06b8a21d2079bf37ab6b0a69dd056c55d4
4
- data.tar.gz: 447f9e6d553e9678df58c72ca65132b00fc21401
3
+ metadata.gz: b924d298951b8a31fa4c0518deab9c81016440b2
4
+ data.tar.gz: 9658119eb3f372c711d8c280791c122468671e9e
5
5
  SHA512:
6
- metadata.gz: 8cc1de95f5adb2d595497ffd14be66fc2ba264cb22ed73401a48ee49c7f63bc1587dcad2be16b838e15b0e4fba8193f5604803a0dd8084bc7e8b14eac1394e2c
7
- data.tar.gz: 0d2d56c53c693cfad6c7a9383c1b9c7fe92b2bd482bc64187a1816e6a7341c4223ade3a4f4310b3160291f5bfd8d05f81ee727c74b55edd0a3d2ee9f49561d11
6
+ metadata.gz: 14e2a280b7cbab02c48532c716f6190e908875dd129eb51ec0d01b7b296afbd466ec5826adac01c8378747cb742f87ed855a18bbf0712993febc2f691c191ad7
7
+ data.tar.gz: 8ecd82e0a16cdf505e5320fc17e64a797c8d26815d10784d34e775f070da975937c2885919e62c05e703bef07876abc335d543a30c6aa0045530af10a895a2e6
data/.gitignore CHANGED
@@ -1,5 +1,7 @@
1
+ *.swp
1
2
  .DS_Store
2
3
  /.bundle/
4
+ /.byebug_history
3
5
  /.ruby-version
4
6
  /Gemfile.lock
5
7
  /pkg/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
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
@@ -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.1.2
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-01-24 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport