Class: Battlestation::Operations::FileExistsCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/battlestation/operations/file_exists_check.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#name, #opts, #type

Instance Method Summary collapse

Methods inherited from Base

#execute

Constructor Details

#initialize(filename, opts = {}) ⇒ FileExistsCheck

Returns a new instance of FileExistsCheck.



6
7
8
9
10
11
# File 'lib/battlestation/operations/file_exists_check.rb', line 6

def initialize(filename, opts = {})
  @filename = filename
  @type     = :file
  @name     = "file-#{filename}"
  @opts     = opts
end

Instance Attribute Details

#filenameObject

Returns the value of attribute filename.



4
5
6
# File 'lib/battlestation/operations/file_exists_check.rb', line 4

def filename
  @filename
end

Instance Method Details

#statusObject



13
14
15
16
17
18
19
# File 'lib/battlestation/operations/file_exists_check.rb', line 13

def status
  if file_exists?
    { status: :okay, msg: "#{filename} found", name: name }
  else
    { status: :fail, msg: "#{filename} not found", resolution: opts[:resolution], name: name }
  end
end