Class: RevealCK::Commands::ListenToRebuildSlides

Inherits:
Object
  • Object
show all
Defined in:
lib/reveal-ck/commands/listen_to_rebuild_slides.rb

Overview

The idea of listening for file system changes and then rebuilding slides.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ui, slides_file, &block) ⇒ ListenToRebuildSlides

Returns a new instance of ListenToRebuildSlides.



9
10
11
12
13
# File 'lib/reveal-ck/commands/listen_to_rebuild_slides.rb', line 9

def initialize(ui, slides_file, &block)
  @ui = ui
  @slides_file = slides_file
  @rebuild_method = block
end

Instance Attribute Details

#rebuild_methodObject (readonly)

Returns the value of attribute rebuild_method.



8
9
10
# File 'lib/reveal-ck/commands/listen_to_rebuild_slides.rb', line 8

def rebuild_method
  @rebuild_method
end

#uiObject (readonly)

Returns the value of attribute ui.



8
9
10
# File 'lib/reveal-ck/commands/listen_to_rebuild_slides.rb', line 8

def ui
  @ui
end

Instance Method Details

#runObject



15
16
17
18
19
# File 'lib/reveal-ck/commands/listen_to_rebuild_slides.rb', line 15

def run
  ::Listen.to('.', only: slides_file_regex) do |mod, add, del|
    message_and_rebuild(mod, add, del)
  end.start
end