head_music 6.0.0 → 7.0.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
  SHA256:
3
- metadata.gz: ee7c3b6377d30fa88d3f9e7f5b5450bf0664c65b4559ba6fccaf79d19ef3cfcf
4
- data.tar.gz: 56ec218fb604b9c1c2fe3a6c2935a1157340afc0a23f3cb882ad9dd9980f1bcd
3
+ metadata.gz: 5329e3d4233738556d545c62cf0c721f42f8736aa483f58b80a6812318af0aa7
4
+ data.tar.gz: 5267548a7f4be05a8a3cbd76354ac1d6cc501475c235b0b5626a725be7f136a1
5
5
  SHA512:
6
- metadata.gz: 6c8b2afd59aae59bcd88a8d67aa1662e79d6086166da1588bdf502a720fb471b2c55b3b6ada13eb7f09e998cd8b8c8408ec4888303d0edd9cdf09accc64c92ed
7
- data.tar.gz: 4076e9b2b22c369f6f7e08bd202cf333d54c410df206bcc0d06417a68142be232ef58fe174aae627922e5a5ef993a9f247e706d23c17cce0f927b49198f3b987
6
+ metadata.gz: 0d90ef9a5432dc7fe68584f6ecccf7b2441aaaf756f5c19555fed48e8bb1f68a5bf0bf124500189f7f4366d62b0901e8910f07e3ed2a7ba43a47e6dddbf9df61
7
+ data.tar.gz: c9787b84e779684e2a807ff9af4bdc4bc98a7eafda0512c1d1beb0c0ab9034a7c28b551983ca914f2b6b364ba968b696086762777c3d58682f76577f811daee0
data/.rubocop.yml CHANGED
@@ -25,5 +25,8 @@ RSpec/ContextWording:
25
25
  - for
26
26
  - by
27
27
 
28
+ RSpec/MultipleExpectations:
29
+ Enabled: false
30
+
28
31
  RSpec/NestedGroups:
29
- Max: 4
32
+ Max: 5
@@ -9,7 +9,7 @@ class HeadMusic::Consonance
9
9
 
10
10
  attr_reader :name
11
11
 
12
- delegate :to_s, to: :name
12
+ delegate :to_s, :to_sym, to: :name
13
13
 
14
14
  def initialize(name)
15
15
  @name = name.to_s.to_sym
@@ -46,7 +46,7 @@ class HeadMusic::Content::Composition
46
46
  end
47
47
 
48
48
  def latest_bar_number
49
- [voices.map(&:earliest_bar_number), 1].flatten.max
49
+ [voices.map(&:latest_bar_number), 1].flatten.max
50
50
  end
51
51
 
52
52
  def cantus_firmus_voice
@@ -58,7 +58,7 @@ class HeadMusic::Content::Composition
58
58
  end
59
59
 
60
60
  def to_s
61
- "#{name} — #{voices.count} voice(s)"
61
+ "#{name} — #{voices.count} #{voices.count == 1 ? 'voice' : 'voices'}"
62
62
  end
63
63
 
64
64
  private
@@ -71,6 +71,7 @@ class HeadMusic::Content::Composition
71
71
  end
72
72
 
73
73
  def last_meter_change(bar_number)
74
+ bar_number = [bar_number, earliest_bar_number].max
74
75
  bars(bar_number)[earliest_bar_number..bar_number].reverse.detect(&:meter)
75
76
  end
76
77
 
@@ -27,10 +27,6 @@ class HeadMusic::Content::Position
27
27
  [bar_number, count, tick_string].join(":")
28
28
  end
29
29
 
30
- def state
31
- [composition.name, code].join(" ")
32
- end
33
-
34
30
  def values
35
31
  [bar_number, count, tick]
36
32
  end
@@ -105,7 +105,9 @@ class HeadMusic::Content::Voice
105
105
  end
106
106
 
107
107
  def to_s
108
- "#{role}: #{pitches.first(10).map(&:to_s)}"
108
+ return pitches_string if role.to_s.strip == ""
109
+
110
+ [role, pitches_string].join(": ")
109
111
  end
110
112
 
111
113
  private
@@ -114,4 +116,8 @@ class HeadMusic::Content::Voice
114
116
  @placements << placement
115
117
  @placements = @placements.sort
116
118
  end
119
+
120
+ def pitches_string
121
+ pitches.first(10).map(&:to_s).join(" ")
122
+ end
117
123
  end