Class: Clef::Core::Tempo
- Inherits:
-
Object
- Object
- Clef::Core::Tempo
- Defined in:
- lib/clef/core/tempo.rb
Instance Attribute Summary collapse
-
#beat_unit ⇒ Object
readonly
Returns the value of attribute beat_unit.
-
#bpm ⇒ Object
readonly
Returns the value of attribute bpm.
Instance Method Summary collapse
-
#initialize(beat_unit:, bpm:) ⇒ Tempo
constructor
A new instance of Tempo.
- #length ⇒ Rational
Constructor Details
#initialize(beat_unit:, bpm:) ⇒ Tempo
Returns a new instance of Tempo.
10 11 12 13 14 15 16 |
# File 'lib/clef/core/tempo.rb', line 10 def initialize(beat_unit:, bpm:) raise ArgumentError, "beat_unit must be a Clef::Core::Duration" unless beat_unit.is_a?(Duration) raise ArgumentError, "bpm must be a positive Integer" unless bpm.is_a?(Integer) && bpm.positive? @beat_unit = beat_unit @bpm = bpm end |
Instance Attribute Details
#beat_unit ⇒ Object (readonly)
Returns the value of attribute beat_unit.
6 7 8 |
# File 'lib/clef/core/tempo.rb', line 6 def beat_unit @beat_unit end |
#bpm ⇒ Object (readonly)
Returns the value of attribute bpm.
6 7 8 |
# File 'lib/clef/core/tempo.rb', line 6 def bpm @bpm end |
Instance Method Details
#length ⇒ Rational
19 20 21 |
# File 'lib/clef/core/tempo.rb', line 19 def length Rational(0, 1) end |