Less a project and more a funny hack. @refriedchicken the other day mentioned that it would be great to make it so method missing would just use AI to implement the method rather than throw an error. So at a hacknight later that day a few of us threw together a quick implementation to show the stupid silly power of AI and Ruby. Think something like "thefuck" only in your ruby app calling methods...
- Install ruby-openai
gem install ruby-openai
- Install dotenv
gem install dotenv
- Copy .env file for access token
cp .env.sample .env
- Add your open AI access token to .env that was copied
- Fire up IRB in console in same directory as this project
- Type
load 'aimissing.rb'
- Type
someobject = MyDynamicClass.new
- Type
someobject.anymethod(anyparams)
ie: any method and params you want You will get an AI generated response for that method and parameter set. ex: someobject.add(2, 5) will return 7