Module: Flying

Defined in:
lib/flying.rb,
lib/flying/bots/up.rb,
lib/flying/version.rb

Defined Under Namespace

Modules: Bot

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.an_error_ocurred(value = '') ⇒ Object



33
34
35
36
# File 'lib/flying.rb', line 33

def self.an_error_ocurred(value = '')
  return @an_error_ocurred if value == ''
  @an_error_ocurred = value
end

.start(&block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/flying.rb', line 12

def self.start(&block)
  begin
    puts "Running..."
    looping = true
    while(looping) do
      yield
      if @an_error_ocurred
        puts "Stopped assessing targets."
        break
      end
      if @first_attempt
        puts "Everything's working fine. I'll continue monitoring the targets."
        @first_attempt = false
      end
      @total_attempts += 1
      sleep(5)
    end
  rescue Interrupt => e
  end
end