{"id":15593078,"url":"https://github.com/benweissmann/fuzzy-ruby","last_synced_at":"2025-10-23T20:32:42.736Z","repository":{"id":56847917,"uuid":"45357901","full_name":"benweissmann/fuzzy-ruby","owner":"benweissmann","description":"Runtime autocorrection for Ruby using fuzzy string matching","archived":false,"fork":false,"pushed_at":"2015-11-01T21:21:06.000Z","size":132,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-07T18:15:51.856Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benweissmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-01T21:17:47.000Z","updated_at":"2017-03-15T15:09:19.000Z","dependencies_parsed_at":"2022-09-22T14:24:24.253Z","dependency_job_id":null,"html_url":"https://github.com/benweissmann/fuzzy-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benweissmann%2Ffuzzy-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benweissmann%2Ffuzzy-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benweissmann%2Ffuzzy-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benweissmann%2Ffuzzy-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benweissmann","download_url":"https://codeload.github.com/benweissmann/fuzzy-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246168110,"owners_count":20734390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T00:04:16.117Z","updated_at":"2025-10-23T20:32:37.698Z","avatar_url":"https://github.com/benweissmann.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nFuzzy Ruby\n==========\n\n[![Build Status](https://travis-ci.org/benweissmann/fuzzy-ruby.svg)](https://travis-ci.org/benweissmann/fuzzy-ruby)\n\nOne of the most difficult parts of programming is spelling everything correctly.\nParticularly in a dynamic-typed language like Ruby, a single typo can cause\na critical runtime failure.\n\nTraditional solutions to this problem include complex static analysis,\nburdonsome code reviews, and onerous unit testing.\n\nFuzzy Ruby is a much easier solution to this problem: it modifies the Ruby\nruntime environment so misspellings will automatically be corrected.\n\n\nExample\n=======\n\nWithout `fuzzy-ruby`:\n\n```ruby\nirb(main):001:0\u003e \"Hello\".revers\nNoMethodError: undefined method `revers' for \"Hello\":String\nirb(main):002:0\u003e my_variable = 123\n=\u003e 123\nirb(main):003:0\u003e my_vraiable\nNameError: undefined local variable or method `my_vraiable' for main:Object\n```\n\nWith `fuzzy-ruby`:\n\n\n```ruby\nrirb(main):001:0\u003e require 'fuzzy-ruby'\n=\u003e true\nirb(main):002:0\u003e \"Hello\".revers\n=\u003e \"olleH\"\nirb(main):003:0\u003e my_variable = 123\n=\u003e 123\nirb(main):004:0\u003e my_vraiable\n=\u003e 123\n```\n\n\nInstallation\n============\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'fuzzy-ruby'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install fuzzy-ruby\n\n\nAdvanced Usage\n==============\n\nA simple `require 'fuzzy-ruby'` will load Fuzzy Ruby and set it up to\nautomatically correct misspellings. However, if you'd like more fine-grained\ncontrol, you can use `require 'fuzzy-ruby/api'`, which just gives you access\nto the `FuzzyRuby` api without modifying your runtime environment.\n\n#### `FuzzyRuby.install`\n\nWithout a block, sets up Fuzzy Ruby to autocorrect misspellings until\n`FuzzyRuby.uninstall` is called. With a block, runs the block with Fuzzy Ruby\ninstalled, and then automatically uninstalls it when the block completes or\nraises an error. The return value or error from the block is propagated up.\n\n#### `FuzzyRuby.uninstall`\n\nUndoes a `FuzzyRuby.install`.\n\n#### `FuzzyRuby.mode = :autocorrect | :autocorrect_with_warning | :warn_only`\n\nSets the mode of Fuzzy Ruby. By default, Fuzzy Ruby uses `:autocorrect`, which\nautomatically corrects typos without warning. Other modes are\n`:autocorrect_with_warning`, which autocorrect but prints a warning to stderr,\nand `:warn_only`, which just prints the warning, but does not correct.\n\n\nLicense\n=======\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n\nHow Does It Work?\n=================\n\nFuzzy Ruby overrides `method_missing` on `Object`. This allows us to intercept\nmethods calls to any object, as well as local variable access. We then grab the\nlist of methods on the object, as well as the list of local variables\n(using the `binding_of_caller` gem) and select the best match using the\nJaro-Winkler text distance algorithm (from the `amatch` gem). We then use\n`eval` or `send` to run the method or access the local variable.\n\n\nNotes\n=====\n\nDon't actually use this. Please.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenweissmann%2Ffuzzy-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenweissmann%2Ffuzzy-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenweissmann%2Ffuzzy-ruby/lists"}