songbook 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/songbook/generate_song_file.rb +4 -1
- data/lib/songbook/render_song.rb +1 -2
- data/lib/songbook/song.rb +5 -2
- data/lib/songbook/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d862405d26a445cf66da2b06ed4fb5c35bb70ad1e14633649d2f05f141d0f340
|
4
|
+
data.tar.gz: d93153d5a854ff317a3be0c20608134aa4c343085eadef3be24ab794abdeb061
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 632ccbdd9d3e895412c0501b7bffdeed7824fb708949eb9eaee7d91e107c0b43d34c9a92a83fa9780ec1eb2da857275476dedcf401c58408f967fb73a17f4398
|
7
|
+
data.tar.gz: 83831f2a8e03990d1bb5fce2b3338c70f62f8764b469865df8fb0bcaac2400f0193583926defa16c1471cc46fe5cf8a4ac6cc5c246f70af46bb791c11ffe59e2
|
@@ -27,11 +27,14 @@ module Songbook
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def song
|
30
|
+
table_width = song_data['config']['table_width'] if song_data['config']
|
31
|
+
|
30
32
|
@song ||= Song.new(
|
31
33
|
title: File.basename(input_path, '.yml'),
|
32
34
|
details: song_data['details'],
|
33
35
|
chords: song_data['chords'],
|
34
|
-
lyrics: song_data['lyrics']
|
36
|
+
lyrics: song_data['lyrics'],
|
37
|
+
table_width: table_width
|
35
38
|
)
|
36
39
|
end
|
37
40
|
|
data/lib/songbook/render_song.rb
CHANGED
@@ -5,7 +5,6 @@ require 'tty-table'
|
|
5
5
|
module Songbook
|
6
6
|
class RenderSong
|
7
7
|
SEPARATOR = [nil, nil].freeze
|
8
|
-
TABLE_WIDTH = 80
|
9
8
|
LYRICS_CHORDS_SEPARATOR = ' '
|
10
9
|
|
11
10
|
attr_reader :song
|
@@ -54,7 +53,7 @@ module Songbook
|
|
54
53
|
|
55
54
|
def lyrics_column_width
|
56
55
|
[
|
57
|
-
|
56
|
+
song.table_width - chords_column_width - LYRICS_CHORDS_SEPARATOR.length,
|
58
57
|
max_lyrics_column_width
|
59
58
|
].min
|
60
59
|
end
|
data/lib/songbook/song.rb
CHANGED
@@ -4,13 +4,16 @@ require_relative 'verse'
|
|
4
4
|
|
5
5
|
module Songbook
|
6
6
|
class Song
|
7
|
-
|
7
|
+
TABLE_WIDTH = 80
|
8
8
|
|
9
|
-
|
9
|
+
attr_reader :title, :details, :chords, :lyrics, :table_width
|
10
|
+
|
11
|
+
def initialize(title:, details:, chords:, lyrics:, table_width: nil)
|
10
12
|
@title = title
|
11
13
|
@details = details
|
12
14
|
@chords = chords
|
13
15
|
@lyrics = lyrics
|
16
|
+
@table_width = table_width || TABLE_WIDTH
|
14
17
|
end
|
15
18
|
|
16
19
|
def verses
|
data/lib/songbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Mendoza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-table
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.1.
|
153
|
+
rubygems_version: 3.1.6
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Songbook
|