Class: Rae
- Inherits:
-
Object
- Object
- Rae
- Defined in:
- lib/rae.rb
Instance Method Summary collapse
-
#initialize ⇒ Rae
constructor
A new instance of Rae.
- #search(word, bus = 3) ⇒ Object
Constructor Details
Instance Method Details
#search(word, bus = 3) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rae.rb', line 11 def search(word, bus = 3) agent = Mechanize.new agent.user_agent_alias = 'Mac Safari' page = agent.get 'http://buscon.rae.es/draeI/html/cabecera.htm' form = page.forms.first form['TIPO_BUS'] = bus form['LEMA'] = word page = agent.submit(form, form..first) parse_page(page, word) end |