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”: /#{}/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 […]

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 […]