Skip to content

markburns/fuzzy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

METHOD MISSING?

NOPE!

Tired of bugs because of typos?

Let fuzzy come to the rescue

class Account
  include Fuzzy

  def pay! other_account, amount
    other_account.balance += amount
    balance -= amount
  end
end

jeff = Account.find 1
a = Account.find 123
a.balance
#=> 10.0

a.paid? jeff, 10
#=> 0.0

What could possibly go wrong?

Nothing! No more pesky exceptions, no more whiny ruby interpreter incapable of making sensible guesses about what you actually meant.

Come on Ruby! Use some common sense.

About

Use method missing to just execute the closest match to the method you tried to call

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages