misspell 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4cc4b1f9115e2299117b0897785ab15a141ccea1
4
+ data.tar.gz: 28260dae1feb174da884b6c5d21bcb2e2be1b7b0
5
+ SHA512:
6
+ metadata.gz: 55ad77e43b99b89e32c7a2071b27c33f19cf1fa226bfb0a225272d97168110a51b42fe3052ebe1100a7c58878037a05ba3b3571324665f5c12a71cda8cbd70bb
7
+ data.tar.gz: 6b0c2855cce15ff90fffdf177bf8186ce7c6b9ceaab2bd8fcb94f83d9842ab624a2e4c1ac5231373f6b7222c6ffcff13dc14fde2cc97e3e69d1480506e27e254
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create ruby-2.0.0-p247@misspell
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'levenshtein'
7
+
8
+ # Add dependencies to develop your gem here.
9
+ # Include everything needed to run rake, tests, features, etc.
10
+ group :development do
11
+ gem "rspec", "~> 2.8.0"
12
+ gem "bundler", "~> 1.0"
13
+ gem "jeweler", "~> 1.8.7"
14
+ end
@@ -0,0 +1,64 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ diff-lcs (1.1.3)
7
+ faraday (0.8.8)
8
+ multipart-post (~> 1.2.0)
9
+ git (1.2.6)
10
+ github_api (0.10.1)
11
+ addressable
12
+ faraday (~> 0.8.1)
13
+ hashie (>= 1.2)
14
+ multi_json (~> 1.4)
15
+ nokogiri (~> 1.5.2)
16
+ oauth2
17
+ hashie (2.0.5)
18
+ highline (1.6.20)
19
+ httpauth (0.2.0)
20
+ jeweler (1.8.8)
21
+ builder
22
+ bundler (~> 1.0)
23
+ git (>= 1.2.5)
24
+ github_api (= 0.10.1)
25
+ highline (>= 1.6.15)
26
+ nokogiri (= 1.5.10)
27
+ rake
28
+ rdoc
29
+ json (1.8.1)
30
+ jwt (0.1.8)
31
+ multi_json (>= 1.5)
32
+ levenshtein (0.2.2)
33
+ multi_json (1.8.2)
34
+ multi_xml (0.5.5)
35
+ multipart-post (1.2.0)
36
+ nokogiri (1.5.10)
37
+ oauth2 (0.9.2)
38
+ faraday (~> 0.8)
39
+ httpauth (~> 0.2)
40
+ jwt (~> 0.1.4)
41
+ multi_json (~> 1.0)
42
+ multi_xml (~> 0.5)
43
+ rack (~> 1.2)
44
+ rack (1.5.2)
45
+ rake (10.1.0)
46
+ rdoc (3.12.2)
47
+ json (~> 1.4)
48
+ rspec (2.8.0)
49
+ rspec-core (~> 2.8.0)
50
+ rspec-expectations (~> 2.8.0)
51
+ rspec-mocks (~> 2.8.0)
52
+ rspec-core (2.8.0)
53
+ rspec-expectations (2.8.0)
54
+ diff-lcs (~> 1.1.2)
55
+ rspec-mocks (2.8.0)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ bundler (~> 1.0)
62
+ jeweler (~> 1.8.7)
63
+ levenshtein
64
+ rspec (~> 2.8.0)
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Ivan Acosta-Rubio
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "misspell"
8
+ s.version = "1.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ivan Acosta-Rubio"]
12
+ s.date = "2013-11-10"
13
+ s.description = "Let's have typos"
14
+ s.email = "ivan@bakedweb.net"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ ".rvmrc",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "Misspell.gemspec",
27
+ "README.md",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "lib/misspell.rb",
31
+ "spec/misspell_spec.rb",
32
+ "spec/spec_helper.rb"
33
+ ]
34
+ s.homepage = "http://github.com/ivanacostarubio/misspell"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "2.0.6"
38
+ s.summary = "Let's have typos"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 4
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<levenshtein>, [">= 0"])
45
+ s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
48
+ else
49
+ s.add_dependency(%q<levenshtein>, [">= 0"])
50
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
51
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
52
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<levenshtein>, [">= 0"])
56
+ s.add_dependency(%q<rspec>, ["~> 2.8.0"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
59
+ end
60
+ end
61
+
@@ -0,0 +1,33 @@
1
+ Misspell
2
+ ====================
3
+
4
+ You can have typos. We'll fix them for you at runtime.
5
+
6
+
7
+ ```ruby
8
+
9
+ class WTF
10
+ include Misspell
11
+
12
+ def attempt
13
+ "wtf"
14
+ end
15
+ end
16
+
17
+ describe WTF do
18
+ let(:wtf) { WTF.new }
19
+
20
+ it "does just as expected" do
21
+ wtf.attempt.should == "wtf"
22
+ end
23
+
24
+ it "calls a method with distance 1" do
25
+ wtf.attemp.should == "wtf"
26
+ end
27
+
28
+ it "calls another method with distance 1" do
29
+ wtf.atempt.should == "wtf"
30
+ end
31
+ end
32
+
33
+ ```
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "misspell"
18
+ gem.homepage = "http://github.com/ivanacostarubio/misspell"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Let's have typos}
21
+ gem.description = %Q{Let's have typos}
22
+ gem.email = "ivan@bakedweb.net"
23
+ gem.authors = ["Ivan Acosta-Rubio"]
24
+ end
25
+ Jeweler::RubygemsDotOrgTasks.new
26
+
27
+ require 'rspec/core'
28
+ require 'rspec/core/rake_task'
29
+ RSpec::Core::RakeTask.new(:spec) do |spec|
30
+ spec.pattern = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
34
+ spec.pattern = 'spec/**/*_spec.rb'
35
+ spec.rcov = true
36
+ end
37
+
38
+ task :default => :spec
39
+
40
+ require 'rdoc/task'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "misspell #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -0,0 +1,11 @@
1
+ require 'levenshtein'
2
+
3
+ module Misspell
4
+ def method_missing(name, *args, &block)
5
+ methods.each do |m|
6
+ return self.send(m) if
7
+ Levenshtein.distance(m.to_s, name.to_s) == 1
8
+ end
9
+ super
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ class WTF
4
+ include Misspell
5
+
6
+ def attempt
7
+ "wtf"
8
+ end
9
+ end
10
+
11
+ describe WTF do
12
+ let(:wtf) { WTF.new }
13
+
14
+ it "does just as expected" do
15
+ wtf.attempt.should == "wtf"
16
+ end
17
+
18
+ it "calls a method with distance 1" do
19
+ wtf.attemp.should == "wtf"
20
+ end
21
+
22
+ it "calls another method with distance 1" do
23
+ wtf.atempt.should == "wtf"
24
+ end
25
+
26
+ it "booms for Levenshtein > 1" do
27
+ expect { wtf.winning? }.to
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'misspell'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: misspell
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Acosta-Rubio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: levenshtein
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 2.8.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 2.8.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: jeweler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.8.7
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.8.7
69
+ description: Let's have typos
70
+ email: ivan@bakedweb.net
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - LICENSE.txt
75
+ - README.md
76
+ files:
77
+ - .document
78
+ - .rspec
79
+ - .rvmrc
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - LICENSE.txt
83
+ - Misspell.gemspec
84
+ - README.md
85
+ - Rakefile
86
+ - VERSION
87
+ - lib/misspell.rb
88
+ - spec/misspell_spec.rb
89
+ - spec/spec_helper.rb
90
+ homepage: http://github.com/ivanacostarubio/misspell
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Let's have typos
114
+ test_files: []