Class: Alda::AtMarker

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

Overview

An at-marker event. An Alda::EventContainer containing an Alda::AtMarker can be created using event list sugar. See Alda::EventList#method_missing.

It should be used together with Alda::Marer. For examples, see Alda::Marker.

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

:call-seq:

new(name) -> Alda::AtMarker

Creates an Alda::AtMarker.

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



1069
1070
1071
1072
# File 'lib/alda-rb/event.rb', line 1069

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

Instance Attribute Details

#nameObject

The corresponding marker’s name



1060
1061
1062
# File 'lib/alda-rb/event.rb', line 1060

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object

:call-seq:

at_marker == other -> true or false

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



1090
1091
1092
# File 'lib/alda-rb/event.rb', line 1090

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

#to_alda_codeObject

:call-seq:

to_alda_code() -> String

Overrides Alda::Event#to_alda_code.



1079
1080
1081
# File 'lib/alda-rb/event.rb', line 1079

def to_alda_code
	?@ + @name
end