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.



14
15
16
17
18
19
# File 'lib/webdrone/mark.rb', line 14

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 (readonly)

Returns the value of attribute a0.



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

def a0
  @a0
end

#clearObject

Returns the value of attribute clear.



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

def clear
  @clear
end

#default_delayObject

Returns the value of attribute default_delay.



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

def default_delay
  @default_delay
end

#default_timesObject

Returns the value of attribute default_times.



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

def default_times
  @default_times
end

Instance Method Details

#mark_clear(item) ⇒ Object



52
53
54
# File 'lib/webdrone/mark.rb', line 52

def mark_clear(item)
  mark_item_border item, nil
end

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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/webdrone/mark.rb', line 36

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