Class: Alda::GetVariable

Inherits:
Event
  • Object
show all
Defined in:
lib/alda-rb/event.rb

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

Attributes inherited from Event

#container, #parent

Instance Method Summary collapse

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

#nameObject

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_codeObject

: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