Class: Dictuby::OnlineDictionary

Inherits:
Object
  • Object
show all
Defined in:
lib/dictuby/online_dictionary.rb

Direct Known Subclasses

SlovnikAzetSK, SlovnikCZ

Class Method Summary collapse

Class Method Details

.dictsObject



18
19
20
# File 'lib/dictuby/online_dictionary.rb', line 18

def self.dicts
    @dicts
end

.lookup(dict, query) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/dictuby/online_dictionary.rb', line 7

def self.lookup(dict, query)
    url = @url % {
        :dict => @dicts[dict],
        :query => query,
    }

    page = Nokogiri::HTML(open(url))

    self.process(page, query)
end