Posts Tagged tips
Bundler default Gemfile and custom Gemfile, example of wirble
Posted by Hallelujah in bundler, gem, rails, ruby on June 29, 2010
Hi all, A simple trick I want to share with you if you are using Bundler (or rails 3) It matters if you want to install wirble gem in your workstation but not in your server Sometimes, you want to include some gem that are not mandatory for your application to run but you want [...]
Ordered Hash by keys
Posted by Hallelujah in Uncategorized on October 2, 2009
Recently, I have to implement my own Hash sorting method. Not really with Hash but with ActiveSupport::OrderedHash I don’t like the way ActiveSupport::OrderedHash behaves with sorting functionality. It just behaves like a simple Hash I would like that sort return an ActiveSupport::OrderedHash not an Arrray!!! Why is it called OrderedHash in this case ? I [...]
Class : to_s or not to_s ? That is the name !
Posted by Hallelujah in best practices, ruby on July 10, 2009
Many rubyist use the method Class#to_s instead of Class#name My purpose (shared by some programmers) is that to_s is just a String representation of the Class not its name!! Imagine you want to store an ordered list of inherited subclasses as a String so you can retrieve the inheritance order of each subclass. class Parent [...]
