ffi-hunspell 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.travis.yml +5 -6
 - data/ChangeLog.md +6 -1
 - data/LICENSE.txt +1 -1
 - data/README.md +1 -1
 - data/Rakefile +0 -3
 - data/gemspec.yml +2 -2
 - data/lib/ffi/hunspell/hunspell.rb +16 -6
 - data/spec/dictionary_spec.rb +53 -53
 - data/spec/hunspell_spec.rb +22 -12
 - data/spec/spec_helper.rb +0 -2
 - metadata +22 -32
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f1f146caea929efea0b2d0ea4853410c9693a271
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7f29da7a3b1a6e272a1f17aed2ff75b771128f56
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 65c59a19ade6f500cfe8782699432efc0a28c573cd81a760982b8335db1d78fe740c521f8a5c526ae66d0fb7a2b94950f32a59d6fc347b9e6411ec14b5b342c8
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 645580d8d22a25966345a86d5303130a801e6236120c02ca8314280f2b79e038ebb3ce68e21864685ca2e24d50807715e34bc6e45a7fcaedae30d8d6ef89c9b7
         
     | 
    
        data/.travis.yml
    CHANGED
    
    | 
         @@ -4,11 +4,10 @@ before_install: 
     | 
|
| 
       4 
4 
     | 
    
         
             
              - gem install ffi rubygems-tasks rspec yard
         
     | 
| 
       5 
5 
     | 
    
         
             
            rvm:
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 1.9.3
         
     | 
| 
       7 
     | 
    
         
            -
              - 2. 
     | 
| 
       8 
     | 
    
         
            -
              - jruby 
     | 
| 
       9 
     | 
    
         
            -
              - rbx 
     | 
| 
      
 7 
     | 
    
         
            +
              - 2.3.0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - jruby
         
     | 
| 
      
 9 
     | 
    
         
            +
              - rbx
         
     | 
| 
       10 
10 
     | 
    
         
             
            matrix:
         
     | 
| 
       11 
11 
     | 
    
         
             
              allow_failures:
         
     | 
| 
       12 
     | 
    
         
            -
                - rvm: rbx 
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            script: rake test
         
     | 
| 
      
 12 
     | 
    
         
            +
                - rvm: rbx
         
     | 
| 
      
 13 
     | 
    
         
            +
            script: rake spec
         
     | 
    
        data/ChangeLog.md
    CHANGED
    
    | 
         @@ -1,9 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ### 0.3.1 / 2016-01-14
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Prefer loading hunspell-1.3 over hunspell-1.2, if both are installed.
         
     | 
| 
      
 4 
     | 
    
         
            +
            * Support auto-detection of hunspell installed by homebrew (@forward3d).
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       1 
6 
     | 
    
         
             
            ### 0.3.0 / 2013-05-01
         
     | 
| 
       2 
7 
     | 
    
         | 
| 
       3 
8 
     | 
    
         
             
            * Detect Ubuntu's hunspell directory (`/usr/share/hunspell`).
         
     | 
| 
       4 
9 
     | 
    
         
             
            * {FFI::Hunspell::Dictionary#encoding} now returns an `Encoding` object.
         
     | 
| 
       5 
10 
     | 
    
         
             
            * Encode Strings returned from {FFI::Hunspell::Dictionary#stem} and
         
     | 
| 
       6 
     | 
    
         
            -
              {FFI::Hunspell::Dictionary# 
     | 
| 
      
 11 
     | 
    
         
            +
              {FFI::Hunspell::Dictionary#suggest} to match the dictionary's native
         
     | 
| 
       7 
12 
     | 
    
         
             
              encoding.
         
     | 
| 
       8 
13 
     | 
    
         | 
| 
       9 
14 
     | 
    
         
             
            ### 0.2.6 / 2013-02-05
         
     | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -2,7 +2,6 @@ require 'rubygems' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'rake'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            begin
         
     | 
| 
       5 
     | 
    
         
            -
              gem 'rubygems-tasks', '~> 0.1'
         
     | 
| 
       6 
5 
     | 
    
         
             
              require 'rubygems/tasks'
         
     | 
| 
       7 
6 
     | 
    
         | 
| 
       8 
7 
     | 
    
         
             
              Gem::Tasks.new
         
     | 
| 
         @@ -12,7 +11,6 @@ rescue LoadError => e 
     | 
|
| 
       12 
11 
     | 
    
         
             
            end
         
     | 
| 
       13 
12 
     | 
    
         | 
| 
       14 
13 
     | 
    
         
             
            begin
         
     | 
| 
       15 
     | 
    
         
            -
              gem 'rspec', '~> 2.4'
         
     | 
| 
       16 
14 
     | 
    
         
             
              require 'rspec/core/rake_task'
         
     | 
| 
       17 
15 
     | 
    
         | 
| 
       18 
16 
     | 
    
         
             
              RSpec::Core::RakeTask.new
         
     | 
| 
         @@ -25,7 +23,6 @@ task :test => :spec 
     | 
|
| 
       25 
23 
     | 
    
         
             
            task :default => :spec
         
     | 
| 
       26 
24 
     | 
    
         | 
| 
       27 
25 
     | 
    
         
             
            begin
         
     | 
| 
       28 
     | 
    
         
            -
              gem 'yard', '~> 0.7'
         
     | 
| 
       29 
26 
     | 
    
         
             
              require 'yard'
         
     | 
| 
       30 
27 
     | 
    
         | 
| 
       31 
28 
     | 
    
         
             
              YARD::Rake::YardocTask.new  
         
     | 
    
        data/gemspec.yml
    CHANGED
    
    | 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            name: ffi-hunspell
         
     | 
| 
       2 
     | 
    
         
            -
            version: 0.3. 
     | 
| 
      
 2 
     | 
    
         
            +
            version: 0.3.1
         
     | 
| 
       3 
3 
     | 
    
         
             
            summary: FFI bindings for Hunspell
         
     | 
| 
       4 
4 
     | 
    
         
             
            description: Ruby FFI bindings for the Hunspell spell checker.
         
     | 
| 
       5 
5 
     | 
    
         
             
            license: MIT
         
     | 
| 
         @@ -17,5 +17,5 @@ dependencies: 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            development_dependencies:
         
     | 
| 
       19 
19 
     | 
    
         
             
              rubygems-tasks: ~> 0.1
         
     | 
| 
       20 
     | 
    
         
            -
              rspec: ~>  
     | 
| 
      
 20 
     | 
    
         
            +
              rspec: ~> 3.0
         
     | 
| 
       21 
21 
     | 
    
         
             
              yard: ~> 0.7
         
     | 
| 
         @@ -4,8 +4,11 @@ module FFI 
     | 
|
| 
       4 
4 
     | 
    
         
             
              module Hunspell
         
     | 
| 
       5 
5 
     | 
    
         
             
                extend FFI::Library
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
                ffi_lib [ 
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
                ffi_lib [
         
     | 
| 
      
 8 
     | 
    
         
            +
                  'hunspell-1.3', 'libhunspell-1.3.so.0',
         
     | 
| 
      
 9 
     | 
    
         
            +
                  'hunspell-1.2', 'libhunspell-1.2.so.0'
         
     | 
| 
      
 10 
     | 
    
         
            +
                ]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       9 
12 
     | 
    
         | 
| 
       10 
13 
     | 
    
         
             
                attach_function :Hunspell_create, [:string, :string], :pointer
         
     | 
| 
       11 
14 
     | 
    
         
             
                attach_function :Hunspell_create_key, [:string, :string, :string], :pointer
         
     | 
| 
         @@ -39,7 +42,7 @@ module FFI 
     | 
|
| 
       39 
42 
     | 
    
         
             
                #
         
     | 
| 
       40 
43 
     | 
    
         
             
                # @since 0.2.0
         
     | 
| 
       41 
44 
     | 
    
         
             
                #
         
     | 
| 
       42 
     | 
    
         
            -
                def  
     | 
| 
      
 45 
     | 
    
         
            +
                def self.lang
         
     | 
| 
       43 
46 
     | 
    
         
             
                  @lang ||= DEFAULT_LANG
         
     | 
| 
       44 
47 
     | 
    
         
             
                end
         
     | 
| 
       45 
48 
     | 
    
         | 
| 
         @@ -54,7 +57,7 @@ module FFI 
     | 
|
| 
       54 
57 
     | 
    
         
             
                #
         
     | 
| 
       55 
58 
     | 
    
         
             
                # @since 0.2.0
         
     | 
| 
       56 
59 
     | 
    
         
             
                #
         
     | 
| 
       57 
     | 
    
         
            -
                def  
     | 
| 
      
 60 
     | 
    
         
            +
                def self.lang=(new_lang)
         
     | 
| 
       58 
61 
     | 
    
         
             
                  @lang = new_lang.to_s
         
     | 
| 
       59 
62 
     | 
    
         
             
                end
         
     | 
| 
       60 
63 
     | 
    
         | 
| 
         @@ -65,6 +68,9 @@ module FFI 
     | 
|
| 
       65 
68 
     | 
    
         
             
                KNOWN_DIRECTORIES = [
         
     | 
| 
       66 
69 
     | 
    
         
             
                  # User
         
     | 
| 
       67 
70 
     | 
    
         
             
                  File.join(Gem.user_home,USER_DIR),
         
     | 
| 
      
 71 
     | 
    
         
            +
                  # OS X brew-instlled hunspell
         
     | 
| 
      
 72 
     | 
    
         
            +
                  File.join(Gem.user_home,'Library/Spelling'),
         
     | 
| 
      
 73 
     | 
    
         
            +
                  '/Library/Spelling',
         
     | 
| 
       68 
74 
     | 
    
         
             
                  # Debian
         
     | 
| 
       69 
75 
     | 
    
         
             
                  '/usr/local/share/myspell/dicts',
         
     | 
| 
       70 
76 
     | 
    
         
             
                  '/usr/share/myspell/dicts',
         
     | 
| 
         @@ -86,12 +92,16 @@ module FFI 
     | 
|
| 
       86 
92 
     | 
    
         
             
                #
         
     | 
| 
       87 
93 
     | 
    
         
             
                # @since 0.2.0
         
     | 
| 
       88 
94 
     | 
    
         
             
                #
         
     | 
| 
       89 
     | 
    
         
            -
                def  
     | 
| 
      
 95 
     | 
    
         
            +
                def self.directories
         
     | 
| 
       90 
96 
     | 
    
         
             
                  @directories ||= KNOWN_DIRECTORIES.select do |path|
         
     | 
| 
       91 
97 
     | 
    
         
             
                    File.directory?(path)
         
     | 
| 
       92 
98 
     | 
    
         
             
                  end
         
     | 
| 
       93 
99 
     | 
    
         
             
                end
         
     | 
| 
       94 
100 
     | 
    
         | 
| 
      
 101 
     | 
    
         
            +
                def self.directories=(dirs)
         
     | 
| 
      
 102 
     | 
    
         
            +
                  @directories = dirs
         
     | 
| 
      
 103 
     | 
    
         
            +
                end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
       95 
105 
     | 
    
         
             
                #
         
     | 
| 
       96 
106 
     | 
    
         
             
                # Opens a Hunspell dictionary.
         
     | 
| 
       97 
107 
     | 
    
         
             
                #
         
     | 
| 
         @@ -106,7 +116,7 @@ module FFI 
     | 
|
| 
       106 
116 
     | 
    
         
             
                #
         
     | 
| 
       107 
117 
     | 
    
         
             
                # @return [nil]
         
     | 
| 
       108 
118 
     | 
    
         
             
                #
         
     | 
| 
       109 
     | 
    
         
            -
                def  
     | 
| 
      
 119 
     | 
    
         
            +
                def self.dict(name=Hunspell.lang,&block)
         
     | 
| 
       110 
120 
     | 
    
         
             
                  Dictionary.open(name,&block)
         
     | 
| 
       111 
121 
     | 
    
         
             
                end
         
     | 
| 
       112 
122 
     | 
    
         
             
              end
         
     | 
    
        data/spec/dictionary_spec.rb
    CHANGED
    
    | 
         @@ -2,30 +2,28 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'ffi/hunspell/dictionary'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            describe Hunspell::Dictionary do
         
     | 
| 
       5 
     | 
    
         
            -
              subject {  
     | 
| 
      
 5 
     | 
    
         
            +
              subject { described_class }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              let(:lang) { 'en_US' }
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
8 
     | 
    
         
             
              let(:affix_path) { File.join(Hunspell.directories.last,"#{lang}.aff") }
         
     | 
| 
       10 
     | 
    
         
            -
              let(:dic_path) 
     | 
| 
      
 9 
     | 
    
         
            +
              let(:dic_path)   { File.join(Hunspell.directories.last,"#{lang}.dic") }
         
     | 
| 
       11 
10 
     | 
    
         | 
| 
       12 
11 
     | 
    
         
             
              describe "#initialize" do
         
     | 
| 
       13 
     | 
    
         
            -
                subject { described_class }
         
     | 
| 
      
 12 
     | 
    
         
            +
                subject { described_class.new(affix_path,dic_path) }
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
       15 
14 
     | 
    
         
             
                it "should create a dictionary from '.aff' and '.dic' files" do
         
     | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
       17 
     | 
    
         
            -
                  dict.should_not be_nil
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                  dict.close
         
     | 
| 
      
 15 
     | 
    
         
            +
                  expect(subject.to_ptr).to_not be_nil
         
     | 
| 
       20 
16 
     | 
    
         
             
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                after { subject.close }
         
     | 
| 
       21 
19 
     | 
    
         
             
              end
         
     | 
| 
       22 
20 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              describe "open" do
         
     | 
| 
      
 21 
     | 
    
         
            +
              describe ".open" do
         
     | 
| 
       24 
22 
     | 
    
         
             
                subject { described_class }
         
     | 
| 
       25 
23 
     | 
    
         | 
| 
       26 
24 
     | 
    
         
             
                it "should find and open a dictionary file for a given language" do
         
     | 
| 
       27 
25 
     | 
    
         
             
                  subject.open(lang) do |dict|
         
     | 
| 
       28 
     | 
    
         
            -
                    dict. 
     | 
| 
      
 26 
     | 
    
         
            +
                    expect(dict).to_not be_nil
         
     | 
| 
       29 
27 
     | 
    
         
             
                  end
         
     | 
| 
       30 
28 
     | 
    
         
             
                end
         
     | 
| 
       31 
29 
     | 
    
         | 
| 
         @@ -33,69 +31,71 @@ describe Hunspell::Dictionary do 
     | 
|
| 
       33 
31 
     | 
    
         
             
                  dict = subject.open(lang)
         
     | 
| 
       34 
32 
     | 
    
         
             
                  dict.close
         
     | 
| 
       35 
33 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
                  dict. 
     | 
| 
      
 34 
     | 
    
         
            +
                  expect(dict).to be_closed
         
     | 
| 
       37 
35 
     | 
    
         
             
                end
         
     | 
| 
       38 
36 
     | 
    
         | 
| 
       39 
37 
     | 
    
         
             
                context "when given an unknown dictionary name" do
         
     | 
| 
       40 
38 
     | 
    
         
             
                  it "should raise an ArgumentError" do
         
     | 
| 
       41 
     | 
    
         
            -
                     
     | 
| 
      
 39 
     | 
    
         
            +
                    expect {
         
     | 
| 
       42 
40 
     | 
    
         
             
                      subject.open('foo')
         
     | 
| 
       43 
     | 
    
         
            -
                    }. 
     | 
| 
      
 41 
     | 
    
         
            +
                    }.to raise_error(ArgumentError)
         
     | 
| 
       44 
42 
     | 
    
         
             
                  end
         
     | 
| 
       45 
43 
     | 
    
         
             
                end
         
     | 
| 
       46 
44 
     | 
    
         
             
              end
         
     | 
| 
       47 
45 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
               
     | 
| 
      
 46 
     | 
    
         
            +
              context "when opened" do
         
     | 
| 
      
 47 
     | 
    
         
            +
                subject { described_class.new(affix_path,dic_path) }
         
     | 
| 
       49 
48 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
              it "should provide the encoding of the dictionary files" do
         
     | 
| 
       53 
     | 
    
         
            -
                subject.encoding.should == Encoding::ISO_8859_1
         
     | 
| 
       54 
     | 
    
         
            -
              end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
              it "should check if a word is valid" do
         
     | 
| 
       57 
     | 
    
         
            -
                subject.should be_valid('dog')
         
     | 
| 
       58 
     | 
    
         
            -
                subject.should_not be_valid('dxg')
         
     | 
| 
       59 
     | 
    
         
            -
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
                after { subject.close }
         
     | 
| 
       60 
50 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                  subject.stem('fishing').should == %w[fishing fish]
         
     | 
| 
      
 51 
     | 
    
         
            +
                it "should provide the encoding of the dictionary files" do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  expect(subject.encoding).to be Encoding::ISO_8859_1
         
     | 
| 
       64 
53 
     | 
    
         
             
                end
         
     | 
| 
       65 
54 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                it "should  
     | 
| 
       67 
     | 
    
         
            -
                  subject. 
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                  }.should be_true
         
     | 
| 
      
 55 
     | 
    
         
            +
                it "should check if a word is valid" do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  expect(subject.valid?('dog')).to be true
         
     | 
| 
      
 57 
     | 
    
         
            +
                  expect(subject.valid?('dxg')).to be false
         
     | 
| 
       70 
58 
     | 
    
         
             
                end
         
     | 
| 
       71 
59 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                 
     | 
| 
       73 
     | 
    
         
            -
                  it "should  
     | 
| 
       74 
     | 
    
         
            -
                    subject.stem( 
     | 
| 
      
 60 
     | 
    
         
            +
                describe "#stem" do
         
     | 
| 
      
 61 
     | 
    
         
            +
                  it "should find the stems of a word" do
         
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(subject.stem('fishing')).to be == %w[fishing fish]
         
     | 
| 
       75 
63 
     | 
    
         
             
                  end
         
     | 
| 
       76 
     | 
    
         
            -
                end
         
     | 
| 
       77 
     | 
    
         
            -
              end
         
     | 
| 
       78 
64 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                     
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
                    'arbitrager',
         
     | 
| 
       85 
     | 
    
         
            -
                    'arbitraged',
         
     | 
| 
       86 
     | 
    
         
            -
                    'arbitrate'
         
     | 
| 
       87 
     | 
    
         
            -
                  ])
         
     | 
| 
       88 
     | 
    
         
            -
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
                  it "should force_encode all strings" do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    expect(subject.suggest('fishing')).to all satisfy { |string|
         
     | 
| 
      
 67 
     | 
    
         
            +
                      string.encoding == subject.encoding
         
     | 
| 
      
 68 
     | 
    
         
            +
                    }
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
       89 
70 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 71 
     | 
    
         
            +
                  context "when there are no stems" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                    it "should return []" do
         
     | 
| 
      
 73 
     | 
    
         
            +
                      expect(subject.stem("zzzzzzz")).to be == []
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
       94 
76 
     | 
    
         
             
                end
         
     | 
| 
       95 
77 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                 
     | 
| 
       97 
     | 
    
         
            -
                  it "should  
     | 
| 
       98 
     | 
    
         
            -
                    subject.suggest( 
     | 
| 
      
 78 
     | 
    
         
            +
                describe "#suggest" do
         
     | 
| 
      
 79 
     | 
    
         
            +
                  it "should suggest alternate spellings for words" do
         
     | 
| 
      
 80 
     | 
    
         
            +
                    expect(subject.suggest('arbitrage')).to include(
         
     | 
| 
      
 81 
     | 
    
         
            +
                      'arbitrage',
         
     | 
| 
      
 82 
     | 
    
         
            +
                      'arbitrages',
         
     | 
| 
      
 83 
     | 
    
         
            +
                      'arbitrager',
         
     | 
| 
      
 84 
     | 
    
         
            +
                      'arbitraged',
         
     | 
| 
      
 85 
     | 
    
         
            +
                      'arbitrate'
         
     | 
| 
      
 86 
     | 
    
         
            +
                    )
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                  it "should force_encode all strings" do
         
     | 
| 
      
 90 
     | 
    
         
            +
                    expect(subject.suggest('arbitrage')).to all satisfy { |string|
         
     | 
| 
      
 91 
     | 
    
         
            +
                      string.encoding == subject.encoding
         
     | 
| 
      
 92 
     | 
    
         
            +
                    }
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
                  context "when there are no suggestions" do
         
     | 
| 
      
 96 
     | 
    
         
            +
                    it "should return []" do
         
     | 
| 
      
 97 
     | 
    
         
            +
                      expect(subject.suggest("________")).to be == []
         
     | 
| 
      
 98 
     | 
    
         
            +
                    end
         
     | 
| 
       99 
99 
     | 
    
         
             
                  end
         
     | 
| 
       100 
100 
     | 
    
         
             
                end
         
     | 
| 
       101 
101 
     | 
    
         
             
              end
         
     | 
    
        data/spec/hunspell_spec.rb
    CHANGED
    
    | 
         @@ -2,24 +2,34 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'ffi/hunspell/hunspell'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            describe Hunspell do
         
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
                subject.lang 
     | 
| 
       7 
     | 
    
         
            -
                subject.lang.should_not be_empty
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
      
 5 
     | 
    
         
            +
              describe ".lang" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                subject { super().lang }
         
     | 
| 
       9 
7 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
                it "should have a default language" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expect(subject).to_not be_nil
         
     | 
| 
      
 10 
     | 
    
         
            +
                  expect(subject).to_not be_empty
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
                subject 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
              describe ".directories" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                subject { super().directories }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                it "should have directories to search within" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  expect(subject).to_not be_empty
         
     | 
| 
       17 
19 
     | 
    
         
             
                end
         
     | 
| 
       18 
20 
     | 
    
         
             
              end
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
       22 
     | 
    
         
            -
                  dict 
     | 
| 
      
 22 
     | 
    
         
            +
              describe ".dict" do
         
     | 
| 
      
 23 
     | 
    
         
            +
                it "should open a dictionary file" do
         
     | 
| 
      
 24 
     | 
    
         
            +
                  subject.dict('en_US') do |dict|
         
     | 
| 
      
 25 
     | 
    
         
            +
                    expect(dict).to_not be_nil
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                it "should open the dictionary file for the default language" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                  subject.dict do |dict|
         
     | 
| 
      
 31 
     | 
    
         
            +
                    expect(dict).to_not be_nil
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
       23 
33 
     | 
    
         
             
                end
         
     | 
| 
       24 
34 
     | 
    
         
             
              end
         
     | 
| 
       25 
35 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,78 +1,69 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ffi-hunspell
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Postmodern
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-01-14 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
14 
     | 
    
         
             
              name: ffi
         
     | 
| 
       16 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
       18 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       20 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
19 
     | 
    
         
             
                    version: '1.0'
         
     | 
| 
       22 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
     | 
    
         
            -
                none: false
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       28 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
26 
     | 
    
         
             
                    version: '1.0'
         
     | 
| 
       30 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
28 
     | 
    
         
             
              name: rubygems-tasks
         
     | 
| 
       32 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       36 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
33 
     | 
    
         
             
                    version: '0.1'
         
     | 
| 
       38 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       39 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       40 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       44 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
40 
     | 
    
         
             
                    version: '0.1'
         
     | 
| 
       46 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       47 
42 
     | 
    
         
             
              name: rspec
         
     | 
| 
       48 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       49 
     | 
    
         
            -
                none: false
         
     | 
| 
       50 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       52 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       54 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       55 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       56 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
     | 
    
         
            -
                none: false
         
     | 
| 
       58 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       60 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       62 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
56 
     | 
    
         
             
              name: yard
         
     | 
| 
       64 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                none: false
         
     | 
| 
       66 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       67 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       68 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
61 
     | 
    
         
             
                    version: '0.7'
         
     | 
| 
       70 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       71 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       72 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
                none: false
         
     | 
| 
       74 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       75 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       76 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       77 
68 
     | 
    
         
             
                    version: '0.7'
         
     | 
| 
       78 
69 
     | 
    
         
             
            description: Ruby FFI bindings for the Hunspell spell checker.
         
     | 
| 
         @@ -84,11 +75,11 @@ extra_rdoc_files: 
     | 
|
| 
       84 
75 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       85 
76 
     | 
    
         
             
            - README.md
         
     | 
| 
       86 
77 
     | 
    
         
             
            files:
         
     | 
| 
       87 
     | 
    
         
            -
            - .gemtest
         
     | 
| 
       88 
     | 
    
         
            -
            - .gitignore
         
     | 
| 
       89 
     | 
    
         
            -
            - .rspec
         
     | 
| 
       90 
     | 
    
         
            -
            - .travis.yml
         
     | 
| 
       91 
     | 
    
         
            -
            - .yardopts
         
     | 
| 
      
 78 
     | 
    
         
            +
            - ".gemtest"
         
     | 
| 
      
 79 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 80 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 81 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 82 
     | 
    
         
            +
            - ".yardopts"
         
     | 
| 
       92 
83 
     | 
    
         
             
            - ChangeLog.md
         
     | 
| 
       93 
84 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       94 
85 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -104,27 +95,26 @@ files: 
     | 
|
| 
       104 
95 
     | 
    
         
             
            homepage: https://github.com/postmodern/ffi-hunspell#readme
         
     | 
| 
       105 
96 
     | 
    
         
             
            licenses:
         
     | 
| 
       106 
97 
     | 
    
         
             
            - MIT
         
     | 
| 
      
 98 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       107 
99 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       108 
100 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       109 
101 
     | 
    
         
             
            require_paths:
         
     | 
| 
       110 
102 
     | 
    
         
             
            - lib
         
     | 
| 
       111 
103 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       112 
     | 
    
         
            -
              none: false
         
     | 
| 
       113 
104 
     | 
    
         
             
              requirements:
         
     | 
| 
       114 
     | 
    
         
            -
              - -  
     | 
| 
      
 105 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       115 
106 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       116 
107 
     | 
    
         
             
                  version: 1.9.1
         
     | 
| 
       117 
108 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       118 
     | 
    
         
            -
              none: false
         
     | 
| 
       119 
109 
     | 
    
         
             
              requirements:
         
     | 
| 
       120 
     | 
    
         
            -
              - -  
     | 
| 
      
 110 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       121 
111 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       122 
112 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       123 
113 
     | 
    
         
             
            requirements:
         
     | 
| 
       124 
114 
     | 
    
         
             
            - libhunspell >= 1.2.0
         
     | 
| 
       125 
115 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       126 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 116 
     | 
    
         
            +
            rubygems_version: 2.4.7
         
     | 
| 
       127 
117 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       128 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 118 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       129 
119 
     | 
    
         
             
            summary: FFI bindings for Hunspell
         
     | 
| 
       130 
120 
     | 
    
         
             
            test_files: []
         
     |