Class: Alda::LispIdentifier
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
-
#name ⇒ Object
The name of the lisp identifier.
Attributes inherited from Event
Instance Method Summary collapse
-
#==(other) ⇒ Object
:call-seq: lisp_identifier == other -> true or false.
-
#initialize(name) ⇒ LispIdentifier
constructor
:call-seq: new(name) -> Alda::LispIdentifier.
-
#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) ⇒ 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
#name ⇒ Object
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_code ⇒ Object
: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 |