Class: AlfonsoX::SpellChecker::Dictionary::Rubymine
- Inherits:
-
Object
- Object
- AlfonsoX::SpellChecker::Dictionary::Rubymine
- 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
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
-
.from_config(yml_config) ⇒ Object
Load configuration from YML.
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ Rubymine
constructor
Initialize Rubymine dictionary If path is not present, it will be loaded from #DEFAULT_PATH.
-
#word_present?(word) ⇒ Boolean
Inform if a word is present in this dictionary.
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
#path ⇒ Object (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.
30 31 32 |
# File 'lib/alfonsox/spellchecker/dictionary/rubymine.rb', line 30 def word_present?(word) @words.include?(word.downcase) end |