Class: Alda::GetVariable
Overview
A get-variable event. An Alda::EventContainer containing an Alda::GetVariable can be derived using event list sugar. See Alda::EventList#method_missing.
This can be ambiguous with Alda::SetVariable and Alda::InlineLisp. For examples, see Alda::SetVariable.
Instance Attribute Summary collapse
-
#name ⇒ Object
The name of the variable.
Attributes inherited from Event
Instance Method Summary collapse
-
#==(other) ⇒ Object
:call-seq: get_variable == other -> true or false.
-
#initialize(name) ⇒ GetVariable
constructor
:call-seq: new(name) -> Alda::GetVariable.
-
#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(name) ⇒ GetVariable
:call-seq:
new(name) -> Alda::GetVariable
Creates an Alda::GetVariable.
1260 1261 1262 1263 |
# File 'lib/alda-rb/event.rb', line 1260 def initialize name super() @name = name end |
Instance Attribute Details
#name ⇒ Object
The name of the variable.
1253 1254 1255 |
# File 'lib/alda-rb/event.rb', line 1253 def name @name end |
Instance Method Details
#==(other) ⇒ Object
:call-seq:
get_variable == other -> true or false
Overrides Alda::Event#==. Returns true if other
is an Alda::GetVariable and has the same #name as get_variable
(using ==
).
1281 1282 1283 |
# File 'lib/alda-rb/event.rb', line 1281 def == other super || other.is_a?(Alda::GetVariable) && @name == other.name end |
#to_alda_code ⇒ Object
:call-seq:
to_alda_code() -> String
Overrides Alda::Event#to_alda_code.
1270 1271 1272 |
# File 'lib/alda-rb/event.rb', line 1270 def to_alda_code @name.to_s end |