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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d20c26b15096f5863840b96174b942278f09216778a856ada04c973565cf4eb9
4
- data.tar.gz: 647f3ab59bb714ab5c0441a61b8f5d932968db85793e8973613830d0a88988ae
3
+ metadata.gz: d862405d26a445cf66da2b06ed4fb5c35bb70ad1e14633649d2f05f141d0f340
4
+ data.tar.gz: d93153d5a854ff317a3be0c20608134aa4c343085eadef3be24ab794abdeb061
5
5
  SHA512:
6
- metadata.gz: 9274349be564d80f1ba11e0b2045fd2887d1dc04b5970b72c63a1bed682074d864514f575aa40fd2d60501ecaae719b670ed065b570723f6e67d1e96163e21db
7
- data.tar.gz: d1bf5d257e46b6e836204855ebf19a5776ae9ee3dea83dd143417f747ca3c62089b10bb91c4dc1729beaa091028014d0681e8c7756605fca6f323af8ef0555a9
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
 
@@ -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
- TABLE_WIDTH - chords_column_width - LYRICS_CHORDS_SEPARATOR.length,
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
- attr_reader :title, :details, :chords, :lyrics
7
+ TABLE_WIDTH = 80
8
8
 
9
- def initialize(title:, details:, chords:, lyrics:)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Songbook
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
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.3.1
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: 2020-03-04 00:00:00.000000000 Z
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.2
153
+ rubygems_version: 3.1.6
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Songbook