Class: MMPlayer::Player::State

Inherits:
Object
  • Object
show all
Defined in:
lib/mmplayer/player/state.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeState

Returns a new instance of State.



14
15
16
17
18
# File 'lib/mmplayer/player/state.rb', line 14

def initialize
  @eof = false
  @play = false
  @pause = false
end

Instance Attribute Details

#eofObject Also known as: eof?

Returns the value of attribute eof.



7
8
9
# File 'lib/mmplayer/player/state.rb', line 7

def eof
  @eof
end

#pauseObject Also known as: pause?, paused?

Returns the value of attribute pause.



7
8
9
# File 'lib/mmplayer/player/state.rb', line 7

def pause
  @pause
end

#playObject Also known as: play?, playing?

Returns the value of attribute play.



7
8
9
# File 'lib/mmplayer/player/state.rb', line 7

def play
  @play
end

Instance Method Details

#eof_reached?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/mmplayer/player/state.rb', line 28

def eof_reached?
  @play && !@eof && !@pause
end

#handle_eofObject



32
33
34
35
# File 'lib/mmplayer/player/state.rb', line 32

def handle_eof
  @eof = true
  @play = false
end

#handle_startObject



37
38
39
40
# File 'lib/mmplayer/player/state.rb', line 37

def handle_start
  @play = true
  @eof = false
end

#progressing?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/mmplayer/player/state.rb', line 24

def progressing?
  @play && !@pause
end

#toggle_pauseObject



20
21
22
# File 'lib/mmplayer/player/state.rb', line 20

def toggle_pause
  @pause = !@pause
end