Class: Lmkplz::Repeatedly

Inherits:
Object
  • Object
show all
Defined in:
lib/lmkplz/repeatedly.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*paths, only: nil, except: nil, &block) ⇒ Repeatedly

Returns a new instance of Repeatedly.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/lmkplz/repeatedly.rb', line 5

def initialize(*paths, only: nil, except: nil, &block)
  @block = block
  @file_filter = FileFilter.new(only: only, except: except)
  paths.each { |path| interface.add(path) }

  interface.on_success do |m, c, r|
    @file_filter.call(m, c, r) do |mm, cc, rr|
      @block.call(mm, cc, rr)
    end
  end
end

Instance Attribute Details

#callbackerObject (readonly)

Returns the value of attribute callbacker.



3
4
5
# File 'lib/lmkplz/repeatedly.rb', line 3

def callbacker
  @callbacker
end

Instance Method Details

#pauseObject



24
25
26
27
28
29
30
31
# File 'lib/lmkplz/repeatedly.rb', line 24

def pause
  if @the_loop.nil?
    return
  end

  the_loop.kill
  @the_loop = nil
end

#startObject



17
18
19
20
21
22
# File 'lib/lmkplz/repeatedly.rb', line 17

def start
  interface.malloc
  the_loop

  nil
end