Class: Clef::Notation::Dynamic

Inherits:
Object
  • Object
show all
Defined in:
lib/clef/notation/dynamic.rb

Constant Summary collapse

TYPES =
%i[pp p mp mf f ff fff sfz fp cresc dim].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Dynamic

Returns a new instance of Dynamic.

Parameters:

  • type (Symbol)

Raises:

  • (ArgumentError)


11
12
13
14
15
# File 'lib/clef/notation/dynamic.rb', line 11

def initialize(type)
  raise ArgumentError, "unsupported dynamic type" unless TYPES.include?(type)

  @type = type
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/clef/notation/dynamic.rb', line 8

def type
  @type
end

Instance Method Details

#lengthRational

Returns:

  • (Rational)


18
19
20
# File 'lib/clef/notation/dynamic.rb', line 18

def length
  Rational(0, 1)
end