Class: WhatIs::Define

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

Instance Method Summary collapse

Constructor Details

#initialize(word, reference) ⇒ Define

Returns a new instance of Define.



22
23
24
25
# File 'lib/what_is.rb', line 22

def initialize(word, reference)
  @word = word.to_s
  @reference = reference.to_sym
end

Instance Method Details

#define!Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/what_is.rb', line 27

def define!

  case @reference
  when :thesaurus
    WhatIs::Thesaurus.new(@word).define!
  when :dictionary
    WhatIs::Dictionary.new(@word).define!
  else
    raise WhatIs::ReferenceUndefinedException
  end

rescue Exception => e
  default_exception_message
end