[opensuse-ruby] Few articles abour ruby and some of its famous gems
Hi, David Majda ask me if I can send some links to interesting articles I found about ruby development also to opensuse-ruby beside yast-devel, as there can be more people interested in it. If you have other opinion feel free to send me mail about it. The first one is about iterative building of collection like create array from another array. I still see it often in code, so it is nice introduction how you can do it. http://robots.thoughtbot.com/iteration-as-an-anti-pattern/ Ideally you should stop yourself before each `each` statement you write what you want achive and use it only if you want tell object to do something. The second one is advanced tips for rspec. Especially I recommend to read rspec style guide - https://github.com/howaboutwe/rspec-style-guide but there is also other interesting tips ( like profilling how long your test took ). http://blog.joshsoftware.com/2013/11/23/pro-tips-for-writing-better-rspec-te... The third one is about quite old feature in yaml, which is still not widely known http://blog.envylabs.com/post/65339158741/keeping-your-yaml-clean which helps to keep yaml file shorted. Here I would like also point to mvidner list of characters in YAML with special meaning - https://github.com/mvidner/yaml-reference The forth one is how to use factory girl outside of rails world and without database - http://collectiveidea.com/blog/archives/2013/11/05/factory-girl-without-acti... The last one is video from ruby conference in 2013 about Delegators and Forwardable and quick look at some presenters library like draper. To my taste it is too long, but contain some examples and explanations. http://www.confreaks.com/videos/2878-rubyconf2013-unleash-the-secrets-of-the... Josef -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
Dne 13.12.2013 13:36, Josef Reidinger napsal(a):
The third one is about quite old feature in yaml, which is still not widely known http://blog.envylabs.com/post/65339158741/keeping-your-yaml-clean which helps to keep yaml file shorted.
JFYI: Ruby uses references in YAML automatically if possible: a = { :a => 1, :b => 2 } puts [ a, a, a ].to_yaml The results is: --- - &8730460 :a: 1 :b: 2 - *8730460 - *8730460 So if you save the save object several times it will be serialized just once and referenced (the "same" here means the same object_id, e.g. different Hash-es although with the same content won't be referenced as they are not the same objects). -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
participants (2)
-
Josef Reidinger
-
Ladislav Slezak