Class: ProgramNameCommandResult

Inherits:
AbstractCommandResult show all
Defined in:
lib/audit/lib/parser/command/program_name_command.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractCommandResult

#check, #message, #severity, #type

Instance Method Summary collapse

Methods inherited from AbstractCommandResult

#visible?

Constructor Details

#initialize(check, severity, message, name, version) ⇒ ProgramNameCommandResult

Returns a new instance of ProgramNameCommandResult.



9
10
11
12
13
# File 'lib/audit/lib/parser/command/program_name_command.rb', line 9

def initialize(check, severity, message, name, version)
  super(check, severity, message || "program found", ResultType::PROGRAM_NAME)
  @program_name = name
  @program_version = version
end

Instance Attribute Details

#program_nameObject (readonly)

Returns the value of attribute program_name.



6
7
8
# File 'lib/audit/lib/parser/command/program_name_command.rb', line 6

def program_name
  @program_name
end

#program_versionObject (readonly)

Returns the value of attribute program_version.



7
8
9
# File 'lib/audit/lib/parser/command/program_name_command.rb', line 7

def program_version
  @program_version
end

Instance Method Details

#to_hashObject



23
24
25
# File 'lib/audit/lib/parser/command/program_name_command.rb', line 23

def to_hash()
  return super.to_hash().merge({:program_name => @program_name, :program_version => @program_version})
end

#to_stringObject



15
16
17
18
19
20
21
# File 'lib/audit/lib/parser/command/program_name_command.rb', line 15

def to_string()
  if @message then
    return "#{@message}: #{@program_name} #{@program_version}"
  else
    return "#{@program_name} #{@program_version}"
  end
end