Class: Musicality::Change::Immediate

Inherits:
Musicality::Change show all
Defined in:
lib/musicality/notation/model/change.rb,
lib/musicality/notation/conversion/change_conversion.rb

Constant Summary

Constants included from Packable

Packable::PACKED_CLASS_KEY

Instance Attribute Summary

Attributes inherited from Musicality::Change

#end_value

Instance Method Summary collapse

Methods inherited from Musicality::Change

#==

Methods included from Packable

#class_str, included, #init_params, #pack, pack_val, recover_class, unpack_val

Constructor Details

#initialize(end_value) ⇒ Immediate

Returns a new instance of Immediate.



18
19
20
# File 'lib/musicality/notation/model/change.rb', line 18

def initialize end_value
  super(end_value)
end

Instance Method Details

#cloneObject



22
23
24
# File 'lib/musicality/notation/model/change.rb', line 22

def clone
  Immediate.new(block_given? ? yield(@end_value) : @end_value)
end

#durationObject



26
# File 'lib/musicality/notation/model/change.rb', line 26

def duration; 0; end

#offsets(base_offset) ⇒ Object



5
6
7
# File 'lib/musicality/notation/conversion/change_conversion.rb', line 5

def offsets base_offset
  [ base_offset ]
end

#remap(base_offset, map) ⇒ Object



9
10
11
# File 'lib/musicality/notation/conversion/change_conversion.rb', line 9

def remap base_offset, map
  self.clone
end

#to_transition(offset, value) ⇒ Object



13
14
15
# File 'lib/musicality/notation/conversion/change_conversion.rb', line 13

def to_transition offset, value
  Transition.new(Function::Constant.new(@end_value), offset..offset)
end