class OxfordLearnersDictionaries::WordOfTheDay

Constants

URL

Attributes

english[R]
short_definition[R]
word[R]

Public Class Methods

new() click to toggle source
# File lib/oxford_learners_dictionaries/word_of_the_day.rb, line 10
def initialize
  parse
end

Public Instance Methods

look_up() click to toggle source
# File lib/oxford_learners_dictionaries/word_of_the_day.rb, line 14
def look_up
  @english = English.new(word).look_up if word
end

Private Instance Methods

parse() click to toggle source
# File lib/oxford_learners_dictionaries/word_of_the_day.rb, line 19
def parse
  @wotd = Nokogiri::HTML(open(URL)).at("#daybox")
  @word = parse_word
  @short_definition = parse_short_definition
end
parse_short_definition() click to toggle source
# File lib/oxford_learners_dictionaries/word_of_the_day.rb, line 29
def parse_short_definition
  @wotd.css(".d").text unless @wotd.nil?
end
parse_word() click to toggle source
# File lib/oxford_learners_dictionaries/word_of_the_day.rb, line 25
def parse_word
  @wotd.css(".h").text unless @wotd.nil?
end