Implement the feature just like AngularJS Promises in Ruby