Class: CVEasy::Keyword

Inherits:
Object
  • Object
show all
Defined in:
lib/CVEasy/keyword.rb

Direct Known Subclasses

Query

Instance Method Summary collapse

Constructor Details

#initialize(td, html) ⇒ Keyword

Returns a new instance of Keyword.



5
6
7
8
# File 'lib/CVEasy/keyword.rb', line 5

def initialize(td, html)
  @td = td
  @html = html
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/CVEasy/keyword.rb', line 14

def description
  @description = @td.at_css('td:nth-child(2)').inner_text.strip if @td.at_css('td:nth-child(2)')
end

#more(&block) ⇒ Object



22
23
24
25
# File 'lib/CVEasy/keyword.rb', line 22

def more(&block)
  cve = Nokogiri::HTML(open(url))
  block.call(Cve.new(cve.at_css('#GeneratedTable'))) if block
end

#nameObject



10
11
12
# File 'lib/CVEasy/keyword.rb', line 10

def name
  @name = @td.at_css('td:nth-child(1) a').inner_text if @td.at_css('td:nth-child(1) a')
end

#urlObject



18
19
20
# File 'lib/CVEasy/keyword.rb', line 18

def url
  @url = BASE_URL + @td.at_css('td:nth-child(1) a')[:href] if @td.at_css('td:nth-child(1) a')[:href]
end