Class: CVEasy::Keyword
- Inherits:
-
Object
- Object
- CVEasy::Keyword
- Defined in:
- lib/CVEasy/keyword.rb
Direct Known Subclasses
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(td, html) ⇒ Keyword
constructor
A new instance of Keyword.
- #more(&block) ⇒ Object
- #name ⇒ Object
- #url ⇒ Object
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
#description ⇒ Object
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 |
#name ⇒ Object
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 |
#url ⇒ Object
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 |