Category: ruby

  • Experimenting with Rails’ String Manipulation from ActiveSupport::CoreExtensions::String::Inflections

    This is my experimentation with the string manipulation methods used [largely internally] in Rails. This is largely a repeat of the documentation here, but I did dig into pluralize/singularize and a couple of other examples more in depth. Look at [path to active_support gem version]/lib/active_support/inflections.rb for the full list of plural, singular, irregular, and uncountable…

  • What Gets Added When I Require a File in Ruby?

    Let’s say you want to know what symbols are added when you require something in ruby. For example, I was curious if I could get a list of symbols that were added when I required ‘english’. I simply used Symbol.all_symbols to save off the old symbol array and the new one and then subtracted the…

  • I love treating primitives as objects #ruby

    #script to generate a .csv testing results file puts “Day,User ID,Action,Start Time,End Time” (1..28).each{ |day| puts “#{day},system,1. Load Step,hh:mm:ss,hh:mm:ss” puts “#{day},system,1a. Raw Data Load,hh:mm:ss,hh:mm:ss” puts “#{day},system,1b. Cube Build,hh:mm:ss,hh:mm:ss” (1..8).each { |user| (1..15).each { |report| puts “#{day},#{user},2. Report #{report},hh:mm:ss,hh:mm:ss” } } (1..5).each { |user| puts “#{day},#{user},3. Query,hh:mm:ss,hh:mm:ss” } }