franzejr / best-ruby

Ruby Tricks, Idiomatic Ruby, Refactoring and Best Practices
http://franzejr.github.io/best-ruby/
2.39k stars 219 forks source link

use of at_exit kernel method #29

Closed eftakhairul closed 8 years ago

eftakhairul commented 8 years ago

I showed the usages of at_exit kernel method. Please let me know if anything need to modify

franzejr commented 8 years ago

@eftakhairul, could you delete the .idea/vcs.xml file ?

eftakhairul commented 8 years ago

I removed that file

rthbound commented 8 years ago

@eftakhairul could you squash? and also consider amending the .gitignore to prevent this in future, @franzejr ?

eftakhairul commented 8 years ago

Done

0x0dea commented 8 years ago

@eftakhairul

You removed the Gitter badge in the README.

eftakhairul commented 8 years ago

@0x0dea I didn't edit the README manually. I just run the command: rake build. Most probably, the command removed the Gitter badge. Should I edit it manually and add the Gitter badge?

franzejr commented 8 years ago

@eftakhairul , I've fixed that this afternoon. Could you pull it again and rake build again? Thanks!

eftakhairul commented 8 years ago

Sure. I will do. On Nov 9, 2015 8:11 PM, "Franzé Jr." notifications@github.com wrote:

@eftakhairul https://github.com/eftakhairul , I've fixed that this afternoon. Could you pull it again and rake build again? Thanks!

— Reply to this email directly or view it on GitHub https://github.com/franzejr/ruby-tricks/pull/29#issuecomment-155251080.

0x0dea commented 8 years ago

@eftakhairul

at_exit is a very nice method and deserves to be showcased, but I think any demonstration of its functionality ought to at least mention that exit handlers are executed in reverse order.

at_exit { p 1 }
at_exit { p 2 }
at_exit { p 3 }

will print

3
2
1

It's also the case that END is a keyword for accessing the same construct (more or less), but I don't know whether it should be mentioned in the trick.

eftakhairul commented 8 years ago

@0x0dea Thanks for the suggestion. I will also update the source code with this example.

eftakhairul commented 8 years ago

@franzejr I again updated my sourcecode. Now, chat is available in README.md. @0x0dea I try to cover your suggestion.

franzejr commented 8 years ago

Nice, @eftakhairul ! Could you just squash your commits in one?! With that, I can merge! Thanks!

eftakhairul commented 8 years ago

@franzejr done

rafaelsales commented 8 years ago

@eftakhairul if you need help squashing all the 10 commits into one: http://stackoverflow.com/a/5189600

eftakhairul commented 8 years ago

@rafaelsales : I already squashing my last five commits into the most last one. It doesn't work?

rafaelsales commented 8 years ago

@eftakhairul Since this PR relates to just one atomic "feature" we think it makes sense to have a single commit for all code changes. Once you squash all into one locally, make sure to execute git push --force

eftakhairul commented 8 years ago

@franzejr : Sorry for knocking you guys to much. Actually, I never tried rebase. Please check and let me know if everything is okay.

jadercorrea commented 8 years ago

@eftakhairul Make sure to rebase master on top of your work. That will fix conflicts and git history will look good.

eftakhairul commented 8 years ago

@jadercorrea So, I will have to merge my branch with master first, then will have to squash my commits ?

jadercorrea commented 8 years ago

Rebase will take all your work on top of master, so there'll be no need to merge and squash. As it would be iff you merged, you'll have to deal with the conflicts, but the result will be better.

eftakhairul commented 8 years ago

@franzejr Done. There is no conflict . You can merge now. @jadercorrea Thanks

jadercorrea commented 8 years ago

:+1: @eftakhairul