Module: Jargon
- Defined in:
- lib/jargon.rb,
lib/jargon/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .buzzwords ⇒ Object
- .find(url) ⇒ Object
- .identify_buzzwords(str) ⇒ Object
- .text_from_html(html_str) ⇒ Object
Class Method Details
.buzzwords ⇒ Object
15 16 17 |
# File 'lib/jargon.rb', line 15 def buzzwords @buzzwords ||= File.read('data/buzzwords.txt').split("\n") end |
.find(url) ⇒ Object
9 10 11 12 13 |
# File 'lib/jargon.rb', line 9 def find(url) html = open(url).read text = text_from_html(html) buzzwords = identify_buzzwords(text) end |
.identify_buzzwords(str) ⇒ Object
23 24 25 26 |
# File 'lib/jargon.rb', line 23 def identify_buzzwords(str) words = str.strip.split(/\s+/) buzzwords.map(&:downcase) & words.map(&:downcase) end |
.text_from_html(html_str) ⇒ Object
19 20 21 |
# File 'lib/jargon.rb', line 19 def text_from_html(html_str) Nokogiri::HTML(html_str).at('body').inner_text end |