Ah, I just noticed that IO#each_line supports a `chomp: true` option much like `readline`. This whole time I've been adding `line.chomp!`.
Any method that accepts "getline_args" will support `chomp: true`. #ruby
FYI if you notice Ctrl^U not working in irb on ruby < 3.2.0, `gem update reline irb` to get the latest version.
Figured out how to convert sign-extended C integers to negative Integers in Ruby:
int = uint & ((2 ** bits) - 1) - (2 ** bits)
assuming uint = 0xffffffff and bits = 32:
(0xffffffff & ((2 ** 32) - 1) - (2 ** 32)
(0xffffffff & (0x1000000 - 1)) - 0x100000000
(0xffffffff & 0xffffffff) - 0x100000000
0xffffffff - 0x100000000
and to determine if the C integer is negative or not, just check the MSB:
uint[bits-1] == 1
and if you choose `Foo::`, what file name should these constants be defined in to make it easy for other files to require them and only them? Or should they be defined in separate files?
`Foo::Gem::` might cause some shadowing issues with the main `Gem::` namespace if `Foo` is meant to be included into other modules, but I listed it anyways.
I still wish there was a combination of `Dir.glob` and `File.join`, as people mostly use those together to find all absolute paths within some other directory.
I didn't realize `Dir[...]` can accept multiple glob patterns, which it then evaluates individually. Also that it accepts a `base:` path key argument.
Released bundler-audit-0.9.1 to fix a regression with the rake task that was introduced in 0.9.0. If you use the rake task in your CI, upgrading to 0.9.1 is highly recommended. #ruby
Big news for Ruby. Shopify is investing heavily in improving Ruby performance and have put together a dream team of researchers. #ruby
What would be a better namespace name then `OpenSSL::PKey`?
Turns out I was doing something wrong... 😳 However, the different ways that the async gem allows nesting Async blocks confused me and caused me to thrash. Where as Crystal's simple non-nested spawn blocks and Channel queues made implementing the concurrent logic much easier.
Software Engineer, Open Source Developer/Maintainer. Mainly Ruby, Crystal, Bash, sometimes ASM, C, C++, Java, Node, PHP, XML/XSLT, HTML/CSS/JS (ES6).
A Mastodon instance for Rubyists & friends