Class: PiSlides::Slideshow

Inherits:
Object
  • Object
show all
Defined in:
lib/pi_slides/slideshow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image_dir, fim, options = {}) ⇒ Slideshow

Returns a new instance of Slideshow.



5
6
7
8
9
10
# File 'lib/pi_slides/slideshow.rb', line 5

def initialize(image_dir, fim, options = {})
  options = { :interval => 30 }.merge options
  @interval = options[:interval]
  @image_dir = image_dir
  @fim = fim
end

Instance Attribute Details

#fimObject (readonly)

Returns the value of attribute fim.



3
4
5
# File 'lib/pi_slides/slideshow.rb', line 3

def fim
  @fim
end

#intervalObject

Returns the value of attribute interval.



3
4
5
# File 'lib/pi_slides/slideshow.rb', line 3

def interval
  @interval
end

Instance Method Details

#joinObject



43
44
45
# File 'lib/pi_slides/slideshow.rb', line 43

def join
  @thread.join
end

#nextObject



31
32
33
# File 'lib/pi_slides/slideshow.rb', line 31

def next
  @skip_to_next = true
end

#pauseObject



23
24
25
# File 'lib/pi_slides/slideshow.rb', line 23

def pause
  @paused = true
end

#paused?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/pi_slides/slideshow.rb', line 35

def paused?
  !!@paused
end

#playObject



27
28
29
# File 'lib/pi_slides/slideshow.rb', line 27

def play
  @paused = false
end

#runObject



51
52
53
# File 'lib/pi_slides/slideshow.rb', line 51

def run
  @thread = Thread.new{ _run }
end

#running?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/pi_slides/slideshow.rb', line 39

def running?
  !paused?
end

#stopObject



47
48
49
# File 'lib/pi_slides/slideshow.rb', line 47

def stop
  @stopped = true
end