Archive for May, 2009

  • Conditionally include development gems - May 28th, 2009

    I was playing with metric_fu and after having to install multiple dependency gems I realised that it was going to be a pain to put the project into production.
    The metric_fu instructions suggest using config.gem in your environment file but that will mean that when you push the app to production, you need to install the [...]

  • Easily compare a variable with multiple values - May 27th, 2009

    I often forget this simple little trick for comparing multiple values against a single variable.
    Instead of
    var = 2
    if var == 1 || var == 2 || var == 3
      puts "yes"
    end
    #=> "yes"
    You can do the following
    var = 2
    if [1,2,3].include?(var)
      puts "yes"
    end
    #=> "yes"