RSpec: Quiet a socketry/console logger in a test

You are writing a test. It raises a well-known exception, and you check for it. Suddenly, there’s log output, since you are working with some concurrent task. Your mood sinks. What’s the way to disable this library’s logging? In this case, I was kindly helped by the library’s author. Quiet a Console.logger in an RSpec …

Ruby feature: Regular Expression replace once

About a year ago, programmer Tony Arcieri posed a question on the Ruby language bug tracker:  Why was Thread.exclusive deprecated? Among the answers to this question, Shyouhei Urabe’s one of the tersest feature descriptions yet: “we already have such thing, to some extent at least”: /#{@mutex=Mutex.new}/o The pair of slashes are Regular Expression delimiters. A Regular …

A disciplined method to fix Rubocop TODOs

Here, a listicle of advice you never asked for! A method to locate and fix linting errors in Rubocop one at a time: choose a “cop” from the .rubocop_todo.yml file remove the line which includes the .rubocop_todo.yml rubocop –only Lint/IneffectiveAccessModifier fix issues and test fixes with the –only invocation rubocop –auto-gen-config to regenerate the .rubocop_todo.yml …

Another Ruby conference

The Ruby folks in Texas know how to please a soft-heart like me: This is a non-profit conference. The organizers are not paid and any profits will be used for future conferences. Also, the financial books are open and we will be publishing payables and receivables. The purpose of this is to help other conference …

Patch day for Rails, in Copenhagen

The inimitable Jakob tells all about the upcoming Rails patch night, so I won’t say more than “it is a great way of getting into Rails” (Rails, the Open Source project; and Rails, the codebase). (I won’t be there, I have a family thing to travel to, but please fill my seat, you.) Hm, I …

Speaking at RuPy conference in Poland

Hey! Even more Ruby crap. They said yes. The RuPy conference (at Adam M University, in Poznan, Poland) wants me to run a RubyGems tutorial. To make it a pleasant event, I’ve started thinking about how to make Win32 users comfortable. Anyone of my readers using Ruby on Windows? What I want my co-tutorialists (tutees?) …

Ruby and libxml: Collect your XML::Node::Set

Use collect and map in Ruby says Lucas Carlson. Thanks for pointing out that code arthritis, Lucas. So, I was working with the libxml-ruby library (fast XML parsing) and found some loops in my code which could be converted. But, XML::Node::Set did not support collect. I mumbled something inaudible, grabbed the Pickaxe book, found the …