Class: MidiLyrics::LyricSyllable
- Inherits:
-
Object
- Object
- MidiLyrics::LyricSyllable
- Defined in:
- lib/midi_lyrics.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#duration_in_pulses ⇒ Object
Returns the value of attribute duration_in_pulses.
-
#start ⇒ Object
Returns the value of attribute start.
-
#start2 ⇒ Object
Returns the value of attribute start2.
-
#start2_in_pulses ⇒ Object
Returns the value of attribute start2_in_pulses.
-
#start_in_pulses ⇒ Object
Returns the value of attribute start_in_pulses.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #as_json ⇒ Object
- #blank? ⇒ Boolean
- #end_in_pulses ⇒ Object
-
#initialize(fields = {}) ⇒ LyricSyllable
constructor
A new instance of LyricSyllable.
- #similar_to?(another) ⇒ Boolean
Constructor Details
#initialize(fields = {}) ⇒ LyricSyllable
Returns a new instance of LyricSyllable.
46 47 48 49 50 51 |
# File 'lib/midi_lyrics.rb', line 46 def initialize(fields = {}) self.start_in_pulses = fields[:start_in_pulses] self.start2_in_pulses = fields[:start2_in_pulses] self.duration_in_pulses = fields[:duration_in_pulses] self.text = fields[:text] end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
44 45 46 |
# File 'lib/midi_lyrics.rb', line 44 def duration @duration end |
#duration_in_pulses ⇒ Object
Returns the value of attribute duration_in_pulses.
43 44 45 |
# File 'lib/midi_lyrics.rb', line 43 def duration_in_pulses @duration_in_pulses end |
#start ⇒ Object
Returns the value of attribute start.
44 45 46 |
# File 'lib/midi_lyrics.rb', line 44 def start @start end |
#start2 ⇒ Object
Returns the value of attribute start2.
44 45 46 |
# File 'lib/midi_lyrics.rb', line 44 def start2 @start2 end |
#start2_in_pulses ⇒ Object
Returns the value of attribute start2_in_pulses.
43 44 45 |
# File 'lib/midi_lyrics.rb', line 43 def start2_in_pulses @start2_in_pulses end |
#start_in_pulses ⇒ Object
Returns the value of attribute start_in_pulses.
43 44 45 |
# File 'lib/midi_lyrics.rb', line 43 def start_in_pulses @start_in_pulses end |
#text ⇒ Object
Returns the value of attribute text.
43 44 45 |
# File 'lib/midi_lyrics.rb', line 43 def text @text end |
Instance Method Details
#as_json ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/midi_lyrics.rb', line 65 def as_json { text: text, start: start, start2: start2, duration: duration } end |
#blank? ⇒ Boolean
57 58 59 |
# File 'lib/midi_lyrics.rb', line 57 def blank? text.gsub('-', '').strip == "" end |
#end_in_pulses ⇒ Object
53 54 55 |
# File 'lib/midi_lyrics.rb', line 53 def end_in_pulses start_in_pulses + duration_in_pulses end |
#similar_to?(another) ⇒ Boolean
61 62 63 |
# File 'lib/midi_lyrics.rb', line 61 def similar_to?(another) self.duration_in_pulses == another.duration_in_pulses && self.text == another.text end |