Compare projects

Project comparisons allow you to view any selection of projects side by side just like they're shown on regular categories or in search results. You can try out an example or start yourself by adding a library to the comparison via the input below. You can also easily share your current comparison with others by sending the URL of the current page.

codeodor-with
0.0
No commit activity in last 3 years
No release in over 3 years
I sometimes get a little descriptive with my variable names, so when you're doing a lot of work specifically with one object, it gets especially ugly and repetetive, making the code harder to read than it needs to be: @contract_participants_on_drugs.contract_id = params[:contract_id] @contract_participants_on_drugs.participant_name = params[:participant_name] @contract_participants_on_drugs.drug_conviction = DrugConvictions.find(:wtf => 'this is getting ridiculous') ... And so on. It gets ridiculous. Utility Belt implements a with(object) method via a change to Object: class Object #utility belt implementation def with(object, &block) object.instance_eval &block end end Unfortunately, that just executes the block in the context of the object, so there isn't any crossover, nor can you perform assignments with attr_accessors (that I was able to do, anyway). So, here's With.object() to fill the void. With.object(@foo) do a = "wtf" b = "this is not as bad" end In the above example, @foo.a and @foo.b are the variables getting set. If you prefer, you can require 'with_on_object' instead and use the notation with(object) do ... end. The tests in the /test directory offer more examples of what's been implemented and tested so far (except where noted - namely performing assignment to a variable that was declared outside the block, and is not on @foo). Not everything is working yet, but it works for the simplest, most common cases I've run up against. More complex tests are on the way, along with code to make them pass. Special thanks to Reg Braithwaite, for help and ideas along the way.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024