Sha256: ad2a25ee7b6321bacadf50fa1d42a8f016806468d2c6f920bfc989577f5ffbe6

Contents?: true

Size: 328 Bytes

Versions: 7

Compression:

Stored size: 328 Bytes

Contents

module Sniffles
  module HTML
    def parse(html)
      @doc = Nokogiri::HTML(html)
    end
    
    def text_at(pattern)
      if (nodes = @doc.search(pattern)).any?
        nodes.text
      else
        false
      end
    end
    
    def text_match?(pattern, text)
      (@doc.search(pattern).text == text)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sniffles-0.1.5 lib/sniffles/html.rb
sniffles-0.1.4 lib/sniffles/html.rb
sniffles-0.1.3 lib/sniffles/html.rb
sniffles-0.1.2 lib/sniffles/html.rb
sniffles-0.1.1 lib/sniffles/html.rb
sniffles-0.1.0.1 lib/sniffles/html.rb
sniffles-0.1.0 lib/sniffles/html.rb