Class: Clef::Ir::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/clef/ir/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(moment:, element:, staff_id: nil, voice_id: nil) ⇒ Event

Returns a new instance of Event.

Parameters:

  • moment (Moment)
  • element (Object)
  • staff_id (Symbol, String, nil) (defaults to: nil)
  • voice_id (Symbol, String, nil) (defaults to: nil)

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
# File 'lib/clef/ir/event.rb', line 12

def initialize(moment:, element:, staff_id: nil, voice_id: nil)
  raise ArgumentError, "moment must be a Clef::Ir::Moment" unless moment.is_a?(Moment)

  @moment = moment
  @element = element
  @staff_id = staff_id
  @voice_id = voice_id
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



6
7
8
# File 'lib/clef/ir/event.rb', line 6

def element
  @element
end

#momentObject (readonly)

Returns the value of attribute moment.



6
7
8
# File 'lib/clef/ir/event.rb', line 6

def moment
  @moment
end

#staff_idObject (readonly)

Returns the value of attribute staff_id.



6
7
8
# File 'lib/clef/ir/event.rb', line 6

def staff_id
  @staff_id
end

#voice_idObject (readonly)

Returns the value of attribute voice_id.



6
7
8
# File 'lib/clef/ir/event.rb', line 6

def voice_id
  @voice_id
end