Class: Wpxf::Utility::ReferenceInflater
- Inherits:
-
Object
- Object
- Wpxf::Utility::ReferenceInflater
- Defined in:
- lib/wpxf/utility/reference_inflater.rb
Overview
A URL inflater for module references.
Instance Method Summary collapse
-
#format_strings ⇒ Hash
The format strings for each reference type identifier.
-
#inflate(id) ⇒ String
Generate the full reference URL from its identifier.
-
#initialize(type) ⇒ ReferenceInflater
constructor
Initializes a new ReferenceInflater.
Constructor Details
#initialize(type) ⇒ ReferenceInflater
Initializes a new Wpxf::Utility::ReferenceInflater.
10 11 12 13 |
# File 'lib/wpxf/utility/reference_inflater.rb', line 10 def initialize(type) raise ArgumentError, 'Unrecognised reference type' unless format_strings.key?(type) @type = type end |
Instance Method Details
#format_strings ⇒ Hash
Returns the format strings for each reference type identifier.
23 24 25 26 27 28 29 30 31 |
# File 'lib/wpxf/utility/reference_inflater.rb', line 23 def format_strings { 'WPVDB' => 'https://wpvulndb.com/vulnerabilities/%s', 'OSVDB' => 'http://www.osvdb.org/%s', 'CVE' => 'http://www.cvedetails.com/cve/CVE-%s', 'EDB' => 'https://www.exploit-db.com/exploits/%s', 'URL' => '%s' } end |
#inflate(id) ⇒ String
Generate the full reference URL from its identifier.
18 19 20 |
# File 'lib/wpxf/utility/reference_inflater.rb', line 18 def inflate(id) format(format_strings[@type], id.to_s) end |