Class: Alda::LispIdentifier

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

Overview

A lisp identifier event. An Alda::EventContainer containing an Alda::Lisp

It is in fact not a kind of event in alda. However, such a thing is needed when writing some lisp codes in alda.

A standalone lisp identifier is useless. Use it together with Alda::InlineLisp.

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) ⇒ LispIdentifier

:call-seq:

new(name) -> Alda::LispIdentifier

Creates an Alda::LispIdentifier.

Underlines “_” in name is converted to hyphens “-”.



1309
1310
1311
1312
# File 'lib/alda-rb/event.rb', line 1309

def initialize name
	super()
	@name = Alda::Utils.snake_to_slug name
end

Instance Attribute Details

#nameObject

The name of the lisp identifier.



1300
1301
1302
# File 'lib/alda-rb/event.rb', line 1300

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

:call-seq:

lisp_identifier == other -> true or false

Overrides Alda::Event#==. Returns true if other is an Alda::LispIdentifier and has the same #name as lisp_identifier (using ==).



1330
1331
1332
# File 'lib/alda-rb/event.rb', line 1330

def == other
	super || other.is_a?(Alda::LispIdentifier) && @name == other.name
end

#to_alda_codeObject

:call-seq:

to_alda_code() -> String

Overrides Alda::Event#to_alda_code.



1319
1320
1321
# File 'lib/alda-rb/event.rb', line 1319

def to_alda_code
	@name
end