Module: WitchDoctor::ApplicationHelper

Defined in:
app/helpers/witch_doctor/application_helper.rb

Constant Summary collapse

UnknownAntivirusScanState =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#antivirus(resource, mount_point) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/witch_doctor/application_helper.rb', line 5

def antivirus(resource, mount_point)
  av = resource.send("#{mount_point}_antivirus")
  if !av.scheduled?
    'Antivirus scan has not been scheduled<br>'.html_safe
  elsif !av.checked?
    'File waiting for Antivirus check<br>'.html_safe
  elsif av.clean?
    yield
  elsif av.error?
    "Antivirus scan couldn't be completed<br>".html_safe
  elsif av.infected?
    'File Contains Virus<br>'.html_safe
  else
    raise UnknownAntivirusScanState
  end
end