Monthly Archives: January 2011

More cool stuff with ruby’s tap method

I had to write up a quick data processor at work today and I wanted a decent output at the end of execution. The ruby tap method came in handy here. class AssetDeliveryPopulater   def self.populate results_text = [] asset_secrets_count, asset_delivery_count, asset_not_found_count, asset_delivery_creation_errors = 0,0,0,0   Email.all.tap{|emails| [...]
Posted in Software | Tagged , | Comments closed

Tap before you squash

Tap is a pretty awesome ruby method I recently discovered. Let’s say I have the following request: post '/api/v1/users/', params.merge(:sig => Authentication.calculate(TestAuthData.secret_access_key,params.to_query) ).to_json I realize [...]
Posted in Software | Tagged , , | Comments closed

RSpec 2, Sinatra and Mongoid example

I spent yesterday coding a very abbreviated version of an authentication service that uses Sinatra, Mongoid and RSpec 2. It took more than a couple hours because there are so many outdated code samples on the web that just don’t work. I put my code up on github for people to see. [...]
Posted in Software | Tagged , , , , , | Comments closed