Sha256: 5fc3672f39d29213001db69456bede79416cc8d6bf8f85f54e9e9eecd74d948d

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

# A staff is a set of lines and spaces that provides context for a pitch
class HeadMusic::Staff
  DEFAULT_LINE_COUNT = 5

  attr_reader :default_clef, :line_count, :instrument

  def initialize(default_clef, instrument: nil, line_count: nil)
    @default_clef = HeadMusic::Clef.get(default_clef)
    @line_count = line_count || DEFAULT_LINE_COUNT
    @instrument = HeadMusic::Instrument.get(instrument) if instrument
  end

  def clef
    default_clef || instrument&.default_staffs&.first
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
head_music-2.0.1 lib/head_music/staff.rb
head_music-2.0.0 lib/head_music/staff.rb