Ruby

Rails is the well known and popular web framework built upon ruby.

Ruby’s Exceptional Creatures is a resource from HoneyBadger that documents common ruby exception.

Fixing implicit declaration error during ruby gem build1

gem install mailcatcher -- --build-flags --with-cflags="-Wno-error=implicit-function-declaration"

Getting the memory size of an object

puts RUBY_VERSION #=>1.9.3

require 'objspace'

p ObjectSpace.memsize_of("a"*23)    #=> 23
p ObjectSpace.memsize_of("a"*24)    #=> 24
p ObjectSpace.memsize_of("a".*1000) #=> 1000
h = {"a"=>1, "b"=>2}
p ObjectSpace.memsize_of(h)         #=> 116
  • Note that this doesn’t do anything for finding the references of an object

Delegation

Memory bloat and management

Halve Your Memory Usage with these 12 Weird Tricks is a conference topic by Nate Berkopec on rails app memory techniques

Setting up a Ruby Gem

As of early 2024:

  1. bundle gem <NEW GEM NAME> will create the new gem folder with rspec setup properly.
  2. Add a CHANGELOG.md file.
  3. Create a new github repo matching the gem name, set it in the gemspec and then use that to set subsequent links
  4. Create a LICENSE file and set the license in the gemspec
  5. Add CI with github actions
  6. Add Coverage with coveralls and CI
  7. Setup gem publishing with github actions

References

1.
Amiridis, P. Fixing the implicit declaration of function error when installing ruby gems. at https://petros.blog/2020/10/02/fixing-the-implicit-declaration-of-function-error-when-installing-ruby-gems/ (2020).