Class: AlfonsoX::SpellChecker::Dictionary::Rubymine

Inherits:
Object
  • Object
show all
Defined in:
lib/alfonsox/spellchecker/dictionary/rubymine.rb

Overview

Rubymine dictionary loader

Constant Summary collapse

DEFAULT_PATH =

Default directory where the XML RubyMine dictionary file should be

'.idea/dictionaries'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil) ⇒ Rubymine

Initialize Rubymine dictionary If path is not present, it will be loaded from #DEFAULT_PATH.



19
20
21
22
# File 'lib/alfonsox/spellchecker/dictionary/rubymine.rb', line 19

def initialize(path = nil)
  @path = path || DEFAULT_PATH
  load_dictionaries
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



15
16
17
# File 'lib/alfonsox/spellchecker/dictionary/rubymine.rb', line 15

def path
  @path
end

Class Method Details

.from_config(yml_config) ⇒ Object

Load configuration from YML



25
26
27
# File 'lib/alfonsox/spellchecker/dictionary/rubymine.rb', line 25

def self.from_config(yml_config)
  new(yml_config.fetch('path') { DEFAULT_PATH })
end

Instance Method Details

#word_present?(word) ⇒ Boolean

Inform if a word is present in this dictionary.

Returns:

  • (Boolean)


30
31
32
# File 'lib/alfonsox/spellchecker/dictionary/rubymine.rb', line 30

def word_present?(word)
  @words.include?(word.downcase)
end