Sha256: ed9994dadc27b7da67b6efc5f4a42e8fe4078670e706a53ae9477d04bd8b9b84

Contents?: true

Size: 802 Bytes

Versions: 1

Compression:

Stored size: 802 Bytes

Contents

module CVEasy
  
  class Keyword
    
    def initialize(td, html)
      @td = td
      @html = html
    end

    def name
      @name = @td.at_css('td:nth-child(1) a').inner_text if @td.at_css('td:nth-child(1) a')
    end
    
    def description
      @description = @td.at_css('td:nth-child(2)').inner_text.strip if @td.at_css('td:nth-child(2)')
    end 
    
    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
    
    def more(&block)
      cve = Nokogiri::HTML(open(url))
      block.call(Cve.new(cve.at_css('#GeneratedTable'))) if block
    end

    # def count
    #   @count ||= @html.at('b:nth-child(2)').inner_text
    # end
    # 
    # def to_s
    #   @html.at('.smaller').inner_text.strip
    # end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
CVEasy-1.0.0 lib/CVEasy/keyword.rb