music-transcription 0.7.2 → 0.7.3

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: 47821dcba8bd951fa6052d201b49c4253bf6a8c0
4
- data.tar.gz: fc84a5d2ea369f1d17fcdf52a82e8d9a61bef9da
3
+ metadata.gz: 2bbc3d1440e2ac88166f035060fda110df18aeb5
4
+ data.tar.gz: 53b0c934d092ca5a176a481b1a00a532e4201ea7
5
5
  SHA512:
6
- metadata.gz: 20284ea1e670062928ef8dc4ea86a342392e6746c7b511ced9ea2e4843a5b9705ffee13302ce984d09d12a01a32ccd2a23e4a25ae8787597afe2e97df3740928
7
- data.tar.gz: 0c9083eb4e7cc5841db15f0f873f3f0835b27b403f1cd428d7536dd9113f5c630e41a7af306f6e2c468d82c4bfe47911681c4eff5c47d6aa69309ca0d05d710f
6
+ metadata.gz: ec1b59468978c4561be944b5c4f61f892399e34a72f5bc790037f3c67f297e64ae7d625a1a69a7cb967239fc20e432d5d2aebe1d9358d792d56cc573747b05a4
7
+ data.tar.gz: 5bd9cd9b7dd02043d28c94ca569ecef5ae1e0ae5dd1990a4dff20ce6aaf0207fb94811805bfc37c5abf0eede7afbce6fc8963c731abf4327da3347af46b7b3c7
@@ -20,7 +20,9 @@ class Note
20
20
  end
21
21
 
22
22
  def ensure_positive_duration
23
- raise ValueNotPositiveError, "duration #{@duration} is not positive" if @duration <= 0
23
+ unless @duration > 0
24
+ raise ValueNotPositiveError, "duration #{@duration} is not positive"
25
+ end
24
26
  end
25
27
 
26
28
  def == other
@@ -33,6 +35,10 @@ class Note
33
35
  def clone
34
36
  Marshal.load(Marshal.dump(self))
35
37
  end
38
+
39
+ def clear_links
40
+ @links = {}
41
+ end
36
42
 
37
43
  def transpose diff
38
44
  self.clone.transpose! diff
@@ -62,10 +68,6 @@ class Note
62
68
  return self
63
69
  end
64
70
 
65
- def valid?
66
- @duration > 0
67
- end
68
-
69
71
  class Sixteenth < Note
70
72
  def initialize pitches = [], links: {}, accent: Accents::NONE
71
73
  super(Rational(1,16),pitches,links:links,accent:accent)
@@ -5,6 +5,7 @@ module Validatable
5
5
 
6
6
  def validate
7
7
  @errors = []
8
+
8
9
  @check_methods.each do |check_method|
9
10
  begin
10
11
  send(check_method)
@@ -12,14 +13,18 @@ module Validatable
12
13
  @errors.push e
13
14
  end
14
15
  end
15
- if respond_to?(:validatables)
16
- validatables.each do |v|
17
- @errors += v.validate
18
- end
16
+
17
+ validatables.each do |v|
18
+ @errors += v.validate
19
19
  end
20
+
20
21
  return @errors
21
22
  end
22
23
 
24
+ def validatables
25
+ []
26
+ end
27
+
23
28
  def valid?
24
29
  self.validate
25
30
  @errors.empty?
@@ -2,6 +2,6 @@
2
2
  module Music
3
3
  module Transcription
4
4
  # music-transcription version
5
- VERSION = "0.7.2"
5
+ VERSION = "0.7.3"
6
6
  end
7
7
  end
data/spec/meter_spec.rb CHANGED
@@ -58,7 +58,7 @@ describe Meter do
58
58
  }.each do |context_str,args|
59
59
  context context_str do
60
60
  it 'should return true' do
61
- Score.new(*args).should be_valid
61
+ Meter.new(*args).should be_valid
62
62
  end
63
63
  end
64
64
  end
@@ -71,7 +71,7 @@ describe Meter do
71
71
  }.each do |context_str,args|
72
72
  context context_str do
73
73
  it 'should return false' do
74
- Score.new(*args).should be_invalid
74
+ Meter.new(*args).should be_invalid
75
75
  end
76
76
  end
77
77
  end
data/spec/note_spec.rb CHANGED
@@ -36,6 +36,14 @@ describe Note do
36
36
  end
37
37
  end
38
38
 
39
+ describe '#clear_links' do
40
+ it 'should remove all links' do
41
+ n = Note.new(2,[C2,E2],links: {C2 => Link::Slur.new(D2)})
42
+ n.clear_links
43
+ n.links.should be_empty
44
+ end
45
+ end
46
+
39
47
  describe '#transpose!' do
40
48
  context 'given pitch diff' do
41
49
  before(:all) do
@@ -113,8 +121,6 @@ describe Note do
113
121
  context 'note with 0 duration' do
114
122
  it 'should return false' do
115
123
  Note.new(0,[C2]).should be_invalid
116
- require 'pry'
117
- binding.pry
118
124
  end
119
125
  end
120
126
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: music-transcription
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Tunnell