4 ms·
Let's clean up the Ruby example a bit, shall we? collection = Braintree::Transaction.search do order_id.begins_with? "a2d" customer_website.end
by psadauskas 16y ago
Let's clean up the Ruby example a bit, shall we?
collection = Braintree::Transaction.search do
order_id.begins_with? "a2d"
customer_website.ends_with? ".com"
billing_first_name == "John"
status.in? Status::Authorized, Status::Settled
amount.between? "10.00", "20.00"
end
collection.each do |transaction|
puts transaction.id
end
- cschep 16y agoare the tabs breaking it into two "columns" idiomatic ruby? I prefer them all flowing "naturally" together.
- dan_manges 16y agoI used to vertically align things into columns in Ruby. It's easy to maintain when you're editing individual lines, but it can easily be messed up with a find-and-replace in file. At that point, it becomes harder to read with some lines off, and a pain to maintain the alignment.
- Calamitous 16y agoIf you use Vim, the Align plugin handles this quite well: http://vim.wikia.com/wiki/Align_text_plugin http://vim.wikia.com/wiki/Align_text_plugin
- scott_s 16y agoI've grown to dislike that habit in all languages. It's too cute and it doesn't scale with code changes. It's easier for me to read code that's formatted in a standard way, even if that means conceptual columns don't line up.
- rue 16y agoamount.within? "10.00".."20.00" Or somesuch. Ranges are always overlooked.