Sha256: 8bda84767c3ec569f535b7685ebbcf9d7b7994a8ba417dc80fe4b02f9b7d0162
Contents?: true
Size: 918 Bytes
Versions: 3
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true # Note is like a placement, except: # - always has a pitch # - doesn't require voice and position class HeadMusic::Note attr_accessor :pitch, :rhythmic_value, :voice, :position def initialize(pitch, rhythmic_value, voice = nil, position = nil) @pitch = HeadMusic::Pitch.get(pitch) @rhythmic_value = HeadMusic::RhythmicValue.get(rhythmic_value) @voice = voice || HeadMusic::Voice.new @position = position || HeadMusic::Position.new(@voice.composition, '1:1') end def placement @placement ||= HeadMusic::Placement.new(voice, position, rhythmic_value, pitch) end def to_s "#{pitch} at #{position}" end def method_missing(method_name, *args, &block) respond_to_missing?(method_name) ? placement.send(method_name, *args, &block) : super end def respond_to_missing?(method_name, *_args) placement.respond_to?(method_name) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.19.1 | lib/head_music/content/note.rb |
head_music-0.19.0 | lib/head_music/content/note.rb |
head_music-0.18.0 | lib/head_music/note.rb |