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 +4 -4
- data/.gitignore +2 -0
- data/lib/pondize/runner.rb +3 -1
- data/lib/pondize/version.rb +1 -1
- data/spec/pondize/command_spec.rb +48 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 396899e7881eee843de22523418bcabb5483293f
|
4
|
+
data.tar.gz: bf058edd811007449f3a76d6c010eec60c46cb9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771c91f1c8b3d435d749c904cf2592b145575ddc2cd2fe6c1b73842fa668994267bc8a9079beb738f26df586360bb4d92277382970c3c9eaf3a3107715a788b4
|
7
|
+
data.tar.gz: aecd011b6a0db82b6533b3bf978abffbfd3b816682794f1f8efbdf2d2f9b20f00cb2e3806d4e9c309b3ac5262cee48cb55c90e388f5dcab154831e4f10ad2793
|
data/.gitignore
ADDED
data/lib/pondize/runner.rb
CHANGED
@@ -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(' .', '.')
|
data/lib/pondize/version.rb
CHANGED
@@ -2,12 +2,55 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Pondize::Convert do
|
4
4
|
describe '#pondize' do
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
10
|
-
|
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.
|
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
|