fretboard 1.4.0 → 1.4.3
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/README.md +568 -29
- data/RELEASE.md +7 -0
- data/bin/fretboard +1 -0
- data/fretboard.gemspec +5 -2
- data/lib/fretboard/builder.rb +3 -3
- data/lib/fretboard/console.rb +1 -1
- data/lib/fretboard/constants.rb +5 -5
- data/lib/fretboard/note.rb +3 -5
- data/lib/fretboard/notes.rb +7 -22
- data/lib/fretboard/parser.rb +3 -3
- data/lib/fretboard/tunings.rb +163 -589
- data/lib/fretboard/version.rb +1 -1
- metadata +26 -11
data/lib/fretboard/builder.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'fretboard/console'
|
6
6
|
|
7
7
|
module Fretboard
|
8
|
-
class Builder
|
8
|
+
class Builder # rubocop:disable Style/Documentation, Metrics/ClassLength
|
9
9
|
# fretboard = Fretboard::Builder.new(:standart)
|
10
10
|
# fretboard = Fretboard::Builder.standart
|
11
11
|
# fretboard = Fretboard::Builder.tuning_a
|
@@ -194,7 +194,7 @@ module Fretboard
|
|
194
194
|
@data = {}
|
195
195
|
end
|
196
196
|
|
197
|
-
def build(sharp_or_flat: :both)
|
197
|
+
def build(sharp_or_flat: :both) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
198
198
|
unless Fretboard::Tunings.exists?(@tuning)
|
199
199
|
Fretboard::Console.danger('Unable to detect guitar tuning')
|
200
200
|
return
|
@@ -235,7 +235,7 @@ module Fretboard
|
|
235
235
|
puts 'done'
|
236
236
|
end
|
237
237
|
|
238
|
-
def draw(sharp_or_flat: :both)
|
238
|
+
def draw(sharp_or_flat: :both) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
239
239
|
unless @data.any?
|
240
240
|
Fretboard::Console.danger('Create the data')
|
241
241
|
return
|
data/lib/fretboard/console.rb
CHANGED
data/lib/fretboard/constants.rb
CHANGED
data/lib/fretboard/note.rb
CHANGED
@@ -3,15 +3,13 @@
|
|
3
3
|
require 'fretboard/notes'
|
4
4
|
|
5
5
|
module Fretboard
|
6
|
-
class Note
|
6
|
+
class Note # rubocop:disable Style/Documentation
|
7
7
|
# Fretboard::Note.next_for('C')
|
8
8
|
# Fretboard::Note.next_for(['F#', 'Gb'])
|
9
9
|
# Fretboard::Note.next_for('F#/Gb')
|
10
10
|
|
11
|
-
def self.next_for(note, sharp_or_flat: :both)
|
12
|
-
all_notes = Fretboard::Notes.all(
|
13
|
-
sharp_or_flat
|
14
|
-
)
|
11
|
+
def self.next_for(note, sharp_or_flat: :both) # rubocop:disable Metrics/MethodLength
|
12
|
+
all_notes = Fretboard::Notes.all(sharp_or_flat)
|
15
13
|
|
16
14
|
if note.is_a?(Array)
|
17
15
|
note = case sharp_or_flat
|
data/lib/fretboard/notes.rb
CHANGED
@@ -1,42 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Fretboard
|
4
|
-
class Notes
|
4
|
+
class Notes # rubocop:disable Style/Documentation
|
5
5
|
# Fretboard::Notes.all(:both)
|
6
6
|
# Fretboard::Notes.all(:sharp)
|
7
7
|
# Fretboard::Notes.all(:flat)
|
8
8
|
|
9
9
|
BASIS_NOTES = {
|
10
10
|
1 => 'C',
|
11
|
-
2 => [
|
12
|
-
'C#',
|
13
|
-
'Db'
|
14
|
-
],
|
11
|
+
2 => ['C#', 'Db'],
|
15
12
|
3 => 'D',
|
16
|
-
4 => [
|
17
|
-
'D#',
|
18
|
-
'Eb'
|
19
|
-
],
|
13
|
+
4 => ['D#', 'Eb'],
|
20
14
|
5 => 'E',
|
21
15
|
6 => 'F',
|
22
|
-
7 => [
|
23
|
-
'F#',
|
24
|
-
'Gb'
|
25
|
-
],
|
16
|
+
7 => ['F#', 'Gb'],
|
26
17
|
8 => 'G',
|
27
|
-
9 => [
|
28
|
-
'G#',
|
29
|
-
'Ab'
|
30
|
-
],
|
18
|
+
9 => ['G#', 'Ab'],
|
31
19
|
10 => 'A',
|
32
|
-
11 => [
|
33
|
-
'A#',
|
34
|
-
'Bb'
|
35
|
-
],
|
20
|
+
11 => ['A#', 'Bb'],
|
36
21
|
12 => 'B'
|
37
22
|
}.freeze
|
38
23
|
|
39
|
-
def self.all(sharp_or_flat = :sharp)
|
24
|
+
def self.all(sharp_or_flat = :sharp) # rubocop:disable Metrics/MethodLength
|
40
25
|
BASIS_NOTES.map do |_key, value|
|
41
26
|
result = value
|
42
27
|
|
data/lib/fretboard/parser.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'active_support/core_ext'
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
4
|
require 'optparse'
|
5
5
|
|
6
6
|
require 'fretboard/builder'
|
@@ -9,7 +9,7 @@ require 'fretboard/note'
|
|
9
9
|
require 'fretboard/tunings'
|
10
10
|
|
11
11
|
module Fretboard
|
12
|
-
class Parser
|
12
|
+
class Parser # rubocop:disable Style/Documentation
|
13
13
|
attr_reader :args
|
14
14
|
|
15
15
|
def self.parse(args)
|
@@ -28,7 +28,7 @@ module Fretboard
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
def parser
|
31
|
+
def parser # rubocop:disable Metrics/MethodLength
|
32
32
|
OptionParser.new do |opts|
|
33
33
|
opts.banner = 'Usage: fretboard [options]'
|
34
34
|
|