Class: Songbook::Song
- Inherits:
-
Object
- Object
- Songbook::Song
- Defined in:
- lib/songbook/song.rb
Instance Attribute Summary collapse
-
#chords ⇒ Object
readonly
Returns the value of attribute chords.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#lyrics ⇒ Object
readonly
Returns the value of attribute lyrics.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title:, details:, chords:, lyrics:) ⇒ Song
constructor
A new instance of Song.
- #verses ⇒ Object
Constructor Details
#initialize(title:, details:, chords:, lyrics:) ⇒ Song
Returns a new instance of Song.
9 10 11 12 13 14 |
# File 'lib/songbook/song.rb', line 9 def initialize(title:, details:, chords:, lyrics:) @title = title @details = details @chords = chords @lyrics = lyrics end |
Instance Attribute Details
#chords ⇒ Object (readonly)
Returns the value of attribute chords.
7 8 9 |
# File 'lib/songbook/song.rb', line 7 def chords @chords end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
7 8 9 |
# File 'lib/songbook/song.rb', line 7 def details @details end |
#lyrics ⇒ Object (readonly)
Returns the value of attribute lyrics.
7 8 9 |
# File 'lib/songbook/song.rb', line 7 def lyrics @lyrics end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/songbook/song.rb', line 7 def title @title end |
Instance Method Details
#verses ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/songbook/song.rb', line 16 def verses lyrics.map do |lyrics_verse| verse_title = find_verse_title(lyrics_verse) verse_lyrics = find_verse_lyrics(lyrics_verse) Verse.new( title: verse_title, lyrics: verse_lyrics, chords: chords[verse_title] ) end end |