Class: Alda::Rest
Overview
Instance Attribute Summary collapse
-
#duration ⇒ Object
The string representing a duration.
Attributes inherited from Event
Instance Method Summary collapse
-
#==(other) ⇒ Object
:call-seq: rest == other -> true or false.
-
#initialize(duration) ⇒ Rest
constructor
:call-seq: new(duration) -> Alda::Rest.
-
#to_alda_code ⇒ Object
:call-seq: to_alda_code() -> String.
Methods inherited from Event
#detach_from_parent, #is_event_of?, #on_contained
Constructor Details
#initialize(duration) ⇒ Rest
:call-seq:
new(duration) -> Alda::Rest
Creates an Alda::Rest.
Underlines “_” in duration
will be converted to tildes “~”.
617 618 619 620 |
# File 'lib/alda-rb/event.rb', line 617 def initialize duration super() @duration = duration.to_s.tr ?_, ?~ end |
Instance Attribute Details
#duration ⇒ Object
The string representing a duration.
608 609 610 |
# File 'lib/alda-rb/event.rb', line 608 def duration @duration end |
Instance Method Details
#==(other) ⇒ Object
:call-seq:
rest == other -> true or false
Overrides Alda::Event#==. Returns true if other
is an Alda::Rest and has the same #duration as rest
(using ==
).
638 639 640 |
# File 'lib/alda-rb/event.rb', line 638 def == other super || other.is_a?(Alda::Rest) && @duration == other.duration end |
#to_alda_code ⇒ Object
:call-seq:
to_alda_code() -> String
Overrides Alda::Event#to_alda_code.
627 628 629 |
# File 'lib/alda-rb/event.rb', line 627 def to_alda_code ?r + @duration end |