close_enough 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ require 'damerau-levenshtein'
2
+
3
+ class Object
4
+ private
5
+
6
+ def method_missing(name, *args)
7
+ dl = DamerauLevenshtein
8
+ ms = methods.map(&:to_s).freeze
9
+ meth = meth = ms.select {|a| dl.distance(name.to_s, a) < 3}.first
10
+
11
+ meth ? send(meth, *args) : super
12
+ end
13
+ end
@@ -0,0 +1,25 @@
1
+ require "spec_helper.rb"
2
+
3
+ module CloseEnoughSpec
4
+
5
+ describe "it should call the closest method on Object" do
6
+ before(:each) do
7
+ @obj = Object.new
8
+ end
9
+
10
+ it "should return the receiver's class" do
11
+ @obj.closs.should == Object
12
+ @obj.claas.should == Object
13
+ end
14
+
15
+ it "should freeze the object" do
16
+ @obj.freze
17
+ @obj.frozne.should == true
18
+ end
19
+
20
+
21
+ end
22
+
23
+
24
+
25
+ end
@@ -0,0 +1,3 @@
1
+ require 'rspec'
2
+
3
+ require File.expand_path("../../lib/close_enough", __FILE__)
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: close_enough
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Micah Gates
9
+ - Jason Lewis
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-03-01 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: damerau-levenshtein
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.5.4
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.5.4
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 2.9.0
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 2.9.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.2
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.9.2
63
+ description: close_enough patches method_missing to calculate the Damerau-Levenshtein
64
+ distance between what you typed, and the existing methods on the current receiver.
65
+ So typos are no longer a big deal.
66
+ email:
67
+ - github@mgates.com
68
+ - jason@decomplecting.org
69
+ executables: []
70
+ extensions: []
71
+ extra_rdoc_files: []
72
+ files:
73
+ - lib/close_enough.rb
74
+ - spec/close_enough_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: https://github.com/ruby-jokes/close_enough
77
+ licenses:
78
+ - GPLv3
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.24
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Mistyping methods? Not a problem.
101
+ test_files: []