Class: RelatedWord

Inherits:
Object
  • Object
show all
Defined in:
lib/related_word.rb,
lib/related_word/version.rb

Defined Under Namespace

Classes: SemanticService

Constant Summary collapse

UnknownService =
Class.new(StandardError)
VERSION =
'0.1.11'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service = :semantic) ⇒ RelatedWord

Returns a new instance of RelatedWord.



9
10
11
# File 'lib/related_word.rb', line 9

def initialize(service = :semantic)
  @service = service
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



7
8
9
# File 'lib/related_word.rb', line 7

def service
  @service
end

Instance Method Details

#find(word) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/related_word.rb', line 13

def find(word)
  if service == :semantic
    SemanticService.new.find(word)
  else
    raise UnknownService
  end
end