Module: Wpxf::ModuleInfo

Included in:
Module
Defined in:
lib/wpxf/core/module_info.rb

Overview

Provides functionality for specifying module metadata.

Instance Method Summary collapse

Instance Method Details

#emit_usage_infoObject

Emits any information that the user should be aware of before using the module.



54
55
56
# File 'lib/wpxf/core/module_info.rb', line 54

def emit_usage_info
  nil
end

#initializeObject

Initialize a new instance of Wpxf::ModuleInfo.



7
8
9
10
# File 'lib/wpxf/core/module_info.rb', line 7

def initialize
  super
  @_module_info = {}
end

#module_authorArray

Returns the name of the module author(s).

Returns:

  • (Array)

    the name of the module author(s).



39
40
41
# File 'lib/wpxf/core/module_info.rb', line 39

def module_author
  @_module_info[:author]
end

#module_dateDate

Returns the disclosure date of the vulnerability.

Returns:

  • (Date)

    the disclosure date of the vulnerability.



44
45
46
# File 'lib/wpxf/core/module_info.rb', line 44

def module_date
  @_module_info[:date]
end

#module_descString

Returns the description of the module.

Returns:

  • (String)

    the description of the module.



29
30
31
# File 'lib/wpxf/core/module_info.rb', line 29

def module_desc
  @_module_info[:desc]
end

#module_description_preformattedBoolean

Returns true if the description is preformatted.

Returns:

  • (Boolean)

    true if the description is preformatted.



49
50
51
# File 'lib/wpxf/core/module_info.rb', line 49

def module_description_preformatted
  @_module_info[:desc_preformatted]
end

#module_nameString

Returns the name of the module.

Returns:

  • (String)

    the name of the module.



24
25
26
# File 'lib/wpxf/core/module_info.rb', line 24

def module_name
  @_module_info[:name]
end

#module_referencesArray

Returns an aray of references relating to the module.

Returns:

  • (Array)

    an aray of references relating to the module.



34
35
36
# File 'lib/wpxf/core/module_info.rb', line 34

def module_references
  @_module_info[:references]
end

#update_info(info) ⇒ Object

Update the module info.

Parameters:

  • info (Hash)

    a hash containing the module info.



14
15
16
17
18
19
20
21
# File 'lib/wpxf/core/module_info.rb', line 14

def update_info(info)
  required_keys = %i[name desc author date]
  unless required_keys.all? { |key| info.key?(key) || @_module_info.key?(key) }
    raise 'Missing one or more required module info keys'
  end

  _update_info_without_validation(info)
end