Class: Webdrone::Mark

Inherits:
Object
  • Object
show all
Defined in:
lib/webdrone/logg.rb,
lib/webdrone/mark.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a0) ⇒ Mark

Returns a new instance of Mark.



11
12
13
14
15
16
# File 'lib/webdrone/mark.rb', line 11

def initialize(a0)
  @a0 = a0
  @default_times = ENV['WEBDRONE_MARK_TIMES'] || 3
  @default_delay = ENV['WEBDRONE_MARK_DELAY'] || 0.05
  @clear = ENV['WEBDRONE_MARK_CLEAR'] == 'true' || false
end

Instance Attribute Details

#a0Object

Returns the value of attribute a0.



9
10
11
# File 'lib/webdrone/mark.rb', line 9

def a0
  @a0
end

#clearObject

Returns the value of attribute clear.



9
10
11
# File 'lib/webdrone/mark.rb', line 9

def clear
  @clear
end

#default_delayObject

Returns the value of attribute default_delay.



9
10
11
# File 'lib/webdrone/mark.rb', line 9

def default_delay
  @default_delay
end

#default_timesObject

Returns the value of attribute default_times.



9
10
11
# File 'lib/webdrone/mark.rb', line 9

def default_times
  @default_times
end

Instance Method Details

#mark_clear(item) ⇒ Object



49
50
51
# File 'lib/webdrone/mark.rb', line 49

def mark_clear(item)
  mark_item_border item, nil
end

#mark_item(item, color: '#af1616', times: nil, delay: nil, shot: nil, text: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/webdrone/mark.rb', line 33

def mark_item(item, color: '#af1616', times: nil, delay: nil, shot: nil, text: nil)
  times ||= @default_times
  delay ||= @default_delay
  times.times do
    mark_item_border item, 'white'
    sleep delay
    mark_item_border item, 'black'
    sleep delay
    mark_item_border item, color
    sleep delay
  end
  @a0.shot.screen shot.is_a?(String) ? shot : text  if shot
  mark_clear item if @clear
  item
end