pondize 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07b7417ecba2f61212e42ae465e321d58879a180
4
- data.tar.gz: e742194e8c77fdc0a0b1a165b267e651bded1ac6
3
+ metadata.gz: 396899e7881eee843de22523418bcabb5483293f
4
+ data.tar.gz: bf058edd811007449f3a76d6c010eec60c46cb9c
5
5
  SHA512:
6
- metadata.gz: 57d142bf069bdeb85fe2f5d31053d973aabc8aef18a0fd27c36c5ea71c421d66c27f3cae53a97c12a99a8feeee926b6df99451b86f10e182eb4f8e0b93c5dc0e
7
- data.tar.gz: 8f397a1fe03dfddfd822007574b2617fb3879f776392d2eb886dbba52e0b04ad98d0b859dd45b1185849f7241c0585beb8757b3cd42fafcf72fc8c2f277e9600
6
+ metadata.gz: 771c91f1c8b3d435d749c904cf2592b145575ddc2cd2fe6c1b73842fa668994267bc8a9079beb738f26df586360bb4d92277382970c3c9eaf3a3107715a788b4
7
+ data.tar.gz: aecd011b6a0db82b6533b3bf978abffbfd3b816682794f1f8efbdf2d2f9b20f00cb2e3806d4e9c309b3ac5262cee48cb55c90e388f5dcab154831e4f10ad2793
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ Gemfile.lock
@@ -26,7 +26,8 @@ module Pondize
26
26
  @chars = chars
27
27
  end
28
28
 
29
- def pondize
29
+ def pondize chars = nil
30
+ @chars = chars || @chars
30
31
  @chars.each_char
31
32
  .map
32
33
  .with_index { |char, index| (notes_to_change.include?(char) && !ACCIDENTALS.include?(@chars[index + 1]) ) ? "#{char}#{change_to}" : char }
@@ -34,6 +35,7 @@ module Pondize
34
35
  .join('')
35
36
  .gsub('n', '')
36
37
  .gsub(/ (\d)/, '\1')
38
+ .gsub(/ -(\d)/, '-\1')
37
39
  .gsub('< <', '<<')
38
40
  .gsub('> >', '>>')
39
41
  .gsub(' .', '.')
@@ -1,3 +1,3 @@
1
1
  module Pondize
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -2,12 +2,55 @@ require 'spec_helper'
2
2
 
3
3
  describe Pondize::Convert do
4
4
  describe '#pondize' do
5
- it 'appends sharps for positive tonality' do
6
- expect(Pondize::Convert.new(3, "c").pondize).to eq("cs")
7
- end
5
+ subject(:convert) { Pondize::Convert.new(tonality, sly) }
6
+ subject { convert.pondize }
7
+
8
+ context 'accidentals addition' do
9
+ context 'in positive tonality' do
10
+ let(:tonality) { 3 }
11
+ let(:sly) { 'c' }
12
+
13
+ it 'appends sharps to notes without accidentals' do
14
+ is_expected.to eq("cs")
15
+ end
16
+
17
+ it 'preserves accidentals in same direction' do
18
+ expect(convert.pondize("cs")).to eq("cs")
19
+ end
20
+
21
+ it 'preserves accidentals in opposite direction changing to lylipond' do
22
+ expect(convert.pondize("cl")).to eq("cf")
23
+ end
24
+
25
+ it 'preserves naturals' do
26
+ expect(convert.pondize("cn")).to eq("c")
27
+ end
28
+
29
+ it 'separtes notes with spaces' do
30
+ expect(convert.pondize("clcncdldndsefg")).to eq("cf c cs df d ds e fs gs")
31
+ end
32
+
33
+ it 'doesnt create spaces for duration marks' do
34
+ expect(convert.pondize("c4rdb4a")).to eq("cs4 r d b4 a")
35
+ end
36
+
37
+ it 'doesnt create spaces for dot marks' do
38
+ expect(convert.pondize("c2.a")).to eq("cs2. a")
39
+ end
40
+
41
+ it 'doesnt create spaces for fingerings' do
42
+ expect(convert.pondize("c2-2a")).to eq("cs2-2 a")
43
+ end
44
+ end
45
+
46
+ context 'in negative tonality' do
47
+ let(:tonality) { -5 }
48
+ let(:sly) { 'a' }
8
49
 
9
- it 'appends flats for negative tonality' do
10
- expect(Pondize::Convert.new(-5, "a").pondize).to eq("af")
50
+ it 'appends flats to notes without accidentals' do
51
+ is_expected.to eq("af")
52
+ end
53
+ end
11
54
  end
12
55
  end
13
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pondize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Tokarski
@@ -32,6 +32,7 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
+ - ".gitignore"
35
36
  - Gemfile
36
37
  - README.md
37
38
  - bin/pondize