Class: RaCwe

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_acunetix/ra_cwe.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, text) ⇒ RaCwe

Returns a new instance of RaCwe.



4
5
6
7
# File 'lib/ruby_acunetix/ra_cwe.rb', line 4

def initialize(id, text)
  self.id = id
  self.text = text
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/ruby_acunetix/ra_cwe.rb', line 2

def id
  @id
end

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/ruby_acunetix/ra_cwe.rb', line 2

def text
  @text
end

#yearObject

Returns the value of attribute year.



2
3
4
# File 'lib/ruby_acunetix/ra_cwe.rb', line 2

def year
  @year
end

Class Method Details

.parse(cwe) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/ruby_acunetix/ra_cwe.rb', line 10

def parse(cwe)
  return nil if cwe.css('CWE').nil? || cwe.css('CWE').text.strip == ''
  
  id = cwe.css('CWE').attribute('id').value
  text = cwe.css('CWE').text
  
  RaCwe.new(id, text)
end