John Backus
John Backus
### Minimal code to reproduce ```ruby def foo(**bar) rescue Baz end ``` ### AST of original code ```sexp (def :foo (args (kwrestarg :bar)) (rescue nil (resbody (array (const nil :Baz))...
Useful for code like ```ruby class User def blah User.recent.first(5) end end ``` in this case the instance method `#blah` doesn't need to repeat its class name and could instead...
I intentionally didn't implement this before because I just wanted to get something simple out first to begin playing with it, but I've already run into a case where I...
``` ruby require 'anima' Anima::VERSION # => "0.4.2" class Dog include Anima.new(:name, :age, :breed) private :breed end spot = Dog.new(name: 'Spot', age: 5, breed: 'Dalmatian') spot # => # spot.with(age:...
I have an object which defines a `#coerce` instance method as part of its public API. I didn't realize until recently that this breaks `#==` for this object and all...
These are equivalent: ```ruby '222-333-4444'.tr_s('^0-9', '') # => "2223334444" '222-333-4444'.delete('^0-9') # => "2223334444" ``` Could probably also do that for `String#tr`. Honestly, I don't know the difference between `tr` and...
Hello old friends. Long time no issue :smile: Often, I will run mutant against `MyApp*` (either locally or in CI) at the end of writing a feature. I have then...
In ruby 2.3: ``` ruby > %w[John Jack Jim Bob Greg Joe].grep_v(/^J/) => ["Bob", "Greg"] > [1, 1.0, '1', 'one'].grep_v(Numeric) => ["1", "one"] ``` Mutating to `Enumerable#grep` is then a...