coltrane 3.1.3 → 3.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
  SHA256:
3
- metadata.gz: ac0d46eac3d20a2fedcaa721b417747a825114751af354ee2006e216ed07c7f4
4
- data.tar.gz: ec03e35092ad2006a41031755b91be814d0e7c7a211fe859a5714823ac7ce7e7
3
+ metadata.gz: 389f01b2c9f2a783e912534f02c9b0a1506f3c9bb4274f3c08c7e94eb18559d6
4
+ data.tar.gz: d2550c127ae11b1798559d41195b3905c6481019195e1a634e54386e14e66215
5
5
  SHA512:
6
- metadata.gz: 4e752677867bafe244e6fcb5df03957a16b1f35b2f2fce127778394197509afabd99a916444d27d90a50694e6dd11fab39cf78d4f17653aa9ef5f8d0b644bfe9
7
- data.tar.gz: ceeee17fffeb15eb6e1cffbb8b9780152d68e7784f656894e543a579f9b195f83e8c8abd5cbf83933d9da2725d5e099d44dab821db46cdd786d5a8006d5ef285
6
+ metadata.gz: 8a5ee68e12b83f27ea1f0da1e74efad208548a6d1376bcc75e828f64c777b24964ac1ce40ee7a9df1e9c9555e3228565335e233938f68231cd656eb64e14057f
7
+ data.tar.gz: 4b84d5abe27a48bf6dff5942860d16be8ae77b18cccff75f507eee1f5de078a8caac1b31fb7333b83181b08b4a7af44241c9ba7a3f8e63288c397e520edd8add
data/CHANGELOG.md CHANGED
@@ -5,6 +5,9 @@
5
5
  - Fix chords so that they generate a barre and a non-barre version and prevent
6
6
  barre chords from picking notes before the barre.
7
7
 
8
+ ## [3.2.0]
9
+ - Adds custom_guitar and custom_guitar_frets
10
+
8
11
  ## [3.1.3]
9
12
  - Several fixes.
10
13
  - Interactive mode
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coltrane (3.1.3)
4
+ coltrane (3.2.0)
5
5
  color (~> 1.8)
6
6
  dry-monads (~> 0.4)
7
7
  paint (~> 2.0)
@@ -32,18 +32,28 @@ module Coltrane
32
32
 
33
33
  def on_model
34
34
  case on
35
- when :text then chord
36
- when :guitar then Representation::Guitar.find_chords(chord).first(voicings)
37
- when :ukulele, :ukelele then Representation::Ukulele.find_chords(chord).first(voicings)
38
- when :bass then Representation::Bass.find_notes(chord.notes)
39
- when :piano then Representation::Piano.find_notes(chord.notes)
40
- when :'guitar-frets' then Representation::Guitar.find_notes(chord.notes)
41
- when :'ukulele-frets', :'ukelele-frets' then Representation::Ukulele.find_notes(chord.notes)
35
+ when :text then chord
36
+ when :guitar then Representation::Guitar.find_chords(chord).first(voicings)
37
+ when :ukulele, :ukelele then Representation::Ukulele.find_chords(chord).first(voicings)
38
+ when :bass then Representation::Bass.find_notes(chord.notes)
39
+ when :piano then Representation::Piano.find_notes(chord.notes)
40
+ when :'guitar-frets' then Representation::Guitar.find_notes(chord.notes)
41
+ when :'ukulele-frets', :'ukelele-frets' then Representation::Ukulele.find_notes(chord.notes)
42
+ when /custom_guitar_frets/ then custom_guitar_notes
43
+ when /custom_guitar/ then custom_guitar_chords.first(voicings)
42
44
  end
43
45
  end
44
46
 
47
+ def custom_guitar_notes
48
+ Representation::Guitar::NoteSet.new(chord.notes, guitar: custom_guitar)
49
+ end
50
+
51
+ def custom_guitar_chords
52
+ Representation::Guitar::Chord.find(chord, guitar: custom_guitar)
53
+ end
54
+
45
55
  def layout_horizontal?
46
- [:guitar, :ukulele, :ukelele, :bass, :piano].include?(on)
56
+ on.to_s =~ /guitar|ukulele|ukelele|bass|piano/
47
57
  end
48
58
 
49
59
  def renderer_options
@@ -5,7 +5,9 @@ module Coltrane
5
5
  on: [
6
6
  '--on <INSTRUMENT>',
7
7
  'Shows the notes on the given instrument/representation type. ' \
8
- 'Can be piano, guitar, ukulele, bass or text'
8
+ 'Can be text, piano, guitar, ukulele, bass.' \
9
+ 'You can also provide a custom guitar using the following format:' \
10
+ '--on custom_guitar=D2-A3-D3-B3-C3'
9
11
  ],
10
12
 
11
13
  flavor: [
@@ -21,6 +23,15 @@ module Coltrane
21
23
  ]
22
24
  }
23
25
 
26
+ def custom_guitar
27
+ on
28
+ .to_s
29
+ .split('=')
30
+ .fetch(1)
31
+ .split('-')
32
+ .yield_self { |tuning| Representation::Guitar.new(tuning: tuning) }
33
+ end
34
+
24
35
  def render
25
36
  puts "\n" + Renderers::TextRenderer.render(
26
37
  representation, **renderer_options
@@ -21,7 +21,7 @@ module Coltrane
21
21
 
22
22
  def on_model
23
23
  case on.to_sym
24
- when :text then notes
24
+ when /custom_guitar/ then custom_guitar_notes
25
25
  when :guitar then Representation::Guitar.find_notes(notes)
26
26
  when :ukulele, :ukelele then Representation::Ukulele.find_notes(notes)
27
27
  when :bass then Representation::Bass.find_notes(notes)
@@ -29,6 +29,10 @@ module Coltrane
29
29
  end
30
30
  end
31
31
 
32
+ def custom_guitar_notes
33
+ Representation::Guitar::NoteSet.new(notes, guitar: custom_guitar)
34
+ end
35
+
32
36
  def self.mercenary_init(program)
33
37
  program.command(:notes) do |c|
34
38
  c.alias(:note)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coltrane
4
- VERSION = '3.1.3'
4
+ VERSION = '3.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coltrane
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Maciel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-08 00:00:00.000000000 Z
11
+ date: 2018-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-reader