Class: Sunniesnow::Charter::BpmChangeList::BpmChange

Inherits:
Object
  • Object
show all
Defined in:
lib/sscharter/charter/beat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(beat, bpm) ⇒ BpmChange

Returns a new instance of BpmChange.

Parameters:

  • beat (Rational)
  • bpm (Float)


26
27
28
29
# File 'lib/sscharter/charter/beat.rb', line 26

def initialize beat, bpm
	@beat = beat
	@bps = bpm / 60.0
end

Instance Attribute Details

#beatRational

Returns:

  • (Rational)


19
20
21
# File 'lib/sscharter/charter/beat.rb', line 19

def beat
  @beat
end

#bpsFloat

Returns:

  • (Float)


22
23
24
# File 'lib/sscharter/charter/beat.rb', line 22

def bps
  @bps
end

Instance Method Details

#<=>(other) ⇒ -1, ...

Parameters:

Returns:

  • (-1, 0, 1)


44
45
46
# File 'lib/sscharter/charter/beat.rb', line 44

def <=> other
	@beat <=> other.beat
end

#bpmFloat

Returns:

  • (Float)


32
33
34
# File 'lib/sscharter/charter/beat.rb', line 32

def bpm
	@bps * 60.0
end

#bpm=(bpm) ⇒ Float

Parameters:

  • bpm (Float)

Returns:

  • (Float)


38
39
40
# File 'lib/sscharter/charter/beat.rb', line 38

def bpm= bpm
	@bps = bpm / 60.0
end