Class: Songbook::RenderSong
- Inherits:
-
Object
- Object
- Songbook::RenderSong
- Defined in:
- lib/songbook/render_song.rb
Constant Summary collapse
- SEPARATOR =
[nil, nil].freeze
- TABLE_WIDTH =
80- LYRICS_CHORDS_SEPARATOR =
' '
Instance Attribute Summary collapse
-
#song ⇒ Object
readonly
Returns the value of attribute song.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(song) ⇒ RenderSong
constructor
A new instance of RenderSong.
Constructor Details
#initialize(song) ⇒ RenderSong
Returns a new instance of RenderSong.
13 14 15 |
# File 'lib/songbook/render_song.rb', line 13 def initialize(song) @song = song end |
Instance Attribute Details
#song ⇒ Object (readonly)
Returns the value of attribute song.
11 12 13 |
# File 'lib/songbook/render_song.rb', line 11 def song @song end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/songbook/render_song.rb', line 17 def call result = <<~RESULT #{song.title}\n #{song.details} #{verses_table} RESULT result.split("\n").map(&:rstrip).join("\n") end |