Class: Lydown::Rendering::Base
- Inherits:
-
Object
- Object
- Lydown::Rendering::Base
show all
- Defined in:
- lib/lydown/rendering/base.rb
Direct Known Subclasses
Barline, BeamClose, BeamOpen, Chord, Command, Comment, Duration, DurationMacro, FiguresSilence, Grace, Literal, Lyrics, Note, RepeatEnd, RepeatStart, RepeatVolta, Rest, Setting, ShortTie, Silence, SlurClose, SlurOpen, SourceRef, StandAloneFigures, Tie, TupletDuration, VoiceSelect
Instance Method Summary
collapse
Constructor Details
#initialize(event, context, stream, idx) ⇒ Base
Returns a new instance of Base.
3
4
5
6
7
8
|
# File 'lib/lydown/rendering/base.rb', line 3
def initialize(event, context, stream, idx)
@event = event
@context = context
@stream = stream
@idx = idx
end
|
Instance Method Details
#find_prev_event(filter) ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/lydown/rendering/base.rb', line 24
def find_prev_event(filter)
prev = prev_event
return nil unless prev
filter.each do |k, v|
return nil unless prev[k] == v
end
prev
end
|
#next_event ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/lydown/rendering/base.rb', line 35
def next_event
idx = @idx + 1
while idx < @stream.size
e = @stream[idx]
return e if e && e[:type] != :comment
idx += 1
end
nil
end
|
#prev_event ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/lydown/rendering/base.rb', line 14
def prev_event
idx = @idx - 1
while idx >= 0
e = @stream[idx]
return e if e && e[:type] != :comment
idx -= 1
end
nil
end
|
#translate ⇒ Object
10
11
12
|
# File 'lib/lydown/rendering/base.rb', line 10
def translate
end
|