Class: Music::Transcription::Tempo

Inherits:
Object
  • Object
show all
Includes:
Parseable
Defined in:
lib/music-transcription/model/tempo.rb,
lib/music-transcription/parsing/convenience_methods.rb

Constant Summary collapse

PARSER =
Parsing::TempoParser.new
CONVERSION_METHOD =
:to_tempo

Constants included from Parseable

Parseable::DEFAULT_SPLIT_PATTERN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Parseable

included

Constructor Details

#initialize(value) ⇒ Tempo

Returns a new instance of Tempo.

Raises:



6
7
8
9
# File 'lib/music-transcription/model/tempo.rb', line 6

def initialize value
  raise NonPositiveError, "Given tempo value #{value} is not positive" if value <= 0
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/music-transcription/model/tempo.rb', line 5

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/music-transcription/model/tempo.rb', line 11

def ==(other)
  self.class == other.class && self.value == other.value
end