Class: Omnibar::Spell

Inherits:
Query
  • Object
show all
Defined in:
lib/omnibar/spell.rb

Instance Attribute Summary

Attributes inherited from Query

#input

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Query

#copy_to_clipboard, inherited, #initialize, #open_in_browser, #preview_text

Constructor Details

This class inherits a constructor from Omnibar::Query

Class Method Details

.spellerObject



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

def self.speller
  @sp ||= FFI::Aspell::Speller.new('en_US')
end

Instance Method Details

#perform!Object



17
18
19
# File 'lib/omnibar/spell.rb', line 17

def perform!
  copy_to_clipboard result
end

#resultObject



5
6
7
# File 'lib/omnibar/spell.rb', line 5

def result
  speller.suggestions(input.split(' ').last).first if input.match?(/^spe?l?l? \w+/)
end

#spellerObject



13
14
15
# File 'lib/omnibar/spell.rb', line 13

def speller
  self.class.speller
end