Module: Iev
- Defined in:
- lib/iev.rb,
lib/iev/db.rb,
lib/iev/version.rb,
lib/iev/db_cache.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.2.4"
Class Method Summary collapse
-
.get(code, lang) ⇒ String?
Scrape Electropedia for term.
Class Method Details
.get(code, lang) ⇒ String?
Scrape Electropedia for term.
16 17 18 19 20 21 |
# File 'lib/iev.rb', line 16 def self.get(code, lang) url = "http://www.electropedia.org/iev/iev.nsf/display?openform&ievref=#{code}" doc = Nokogiri::HTML OpenURI.open_uri(url), nil, "UTF-8" xpath = "//table/tr/td/div/font[.=\"#{lang}\"]/../../following-sibling::td[2]" doc.at(xpath)&.text&.strip end |