Class: FrameworkGuesser::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/framework_guesser/matcher.rb

Instance Method Summary collapse

Instance Method Details

#match(headers, body) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/framework_guesser/matcher.rb', line 5

def match(headers, body)
  @headers = headers
  @data = body
  @result = { :features => [] }
  @document = Nokogiri::HTML(@data)

  description = @document.css("meta[name=description], meta[name=Description]").first
  @result[:description] = description['content'] if description

  keywords = @document.css("meta[name=keywords], meta[name=keywords]").first
  @result[:keywords] = keywords['content'] if keywords

  run
  @result[:features].uniq!
  @result
end