Class: Alda::Raw
Overview
A special event that contains raw Alda codes. This is a walkaround for the absence of alda-code
function in Alda 2 (alda-lang/alda#379). You can use Alda::EventList#raw to add an Alda::Raw event to the event list.
Instance Attribute Summary collapse
-
#contents ⇒ Object
The raw Alda codes.
Attributes inherited from Event
Instance Method Summary collapse
-
#==(other) ⇒ Object
:call-seq: raw == other -> true or false.
-
#initialize(contents) ⇒ Raw
constructor
:call-seq: new(code) -> Alda::Raw.
-
#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(contents) ⇒ Raw
:call-seq:
new(code) -> Alda::Raw
Creates an Alda::Raw.
1351 1352 1353 1354 |
# File 'lib/alda-rb/event.rb', line 1351 def initialize contents super() @contents = contents end |
Instance Attribute Details
#contents ⇒ Object
The raw Alda codes.
1344 1345 1346 |
# File 'lib/alda-rb/event.rb', line 1344 def contents @contents end |
Instance Method Details
#==(other) ⇒ Object
:call-seq:
raw == other -> true or false
Overrides Alda::Event#==. Returns true if other
is an Alda::Raw and has the same #contents as raw
(using ==
).
1372 1373 1374 |
# File 'lib/alda-rb/event.rb', line 1372 def == other super || other.is_a?(Alda::Raw) && @contents == other.contents end |
#to_alda_code ⇒ Object
:call-seq:
to_alda_code() -> String
Overrides Alda::Event#to_alda_code.
1361 1362 1363 |
# File 'lib/alda-rb/event.rb', line 1361 def to_alda_code @contents end |