LittleWeasel 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'LittleWeasel/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "LittleWeasel"
8
+ spec.version = LittleWeasel::VERSION
9
+ spec.authors = ["Gene M. Angelo, Jr."]
10
+ spec.email = ["public.gma@gmail.com"]
11
+ spec.description = %q{Simply checks a word for validity against an english dictionary file.}
12
+ spec.summary = %q{Simply checks a word for validity against an english dictionary file.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # LittleWeasel
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'LittleWeasel'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install LittleWeasel
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
30
+
31
+ ## License
32
+
33
+ (The MIT License)
34
+
35
+ Copyright © 2011 Tair Assimov
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ rescue LoadError => e
7
+ task "spec" do
8
+ puts "RSpec not loaded - make sure it's installed and you're using bundle exec"
9
+ exit 1
10
+ end
11
+ end
12
+
13
+ task :default => :spec
@@ -0,0 +1,31 @@
1
+ require 'singleton'
2
+
3
+ module LittleWeasel
4
+
5
+ class Checker
6
+ include Singleton
7
+
8
+ attr_reader :dictionary
9
+
10
+ def initialize
11
+ @dictionary = Hash.new(1)
12
+ load
13
+ end
14
+
15
+ def exists?(word)
16
+ dictionary.has_key? word
17
+ end
18
+
19
+ private
20
+
21
+ def dictionary_path
22
+ File.expand_path(File.dirname(__FILE__) + '/dictionary')
23
+ end
24
+
25
+ def load
26
+ File.open(dictionary_path) do |io|
27
+ io.each { |line| line.chomp!; @dictionary[line] = line }
28
+ end
29
+ end
30
+ end
31
+ end