The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Gem of Week #13 - props gem - yet another config (INI) reader in Ruby
Hello, over at the Planet Ruby the Gem of the Week series continues with #13 - props - yet another config (INI) reader - that lets you read in configuration settings in the Windows-inspired INI format and lets you link up settings in hashes in a lookup hierarchy and so on. Full article. Cheers.
gem install abstract_class
The abstract class pattern implemented in Ruby: https://github.com/shuber/abstract_class [more inside]
SOLID Review: Interface Segregation Principle
My take on the Interface Segregation Principle in Ruby. Using Ruby modules, we can see the important role cohesive “interfaces” play, even in duck-typed languages. This leads to less coupling and more readable code.
Exceptions should not be expected – stop using them for control flow
If your exceptions aren’t exceptions but expectations, you’re doing it wrong. Raising (failing) and rescuing errors might look as a good idea but it isn’t. Read the article to find out why.
2 more ways to monetize open source software
I’ve already written about how to monetize open source software using educational materials and hosting. Today’s article is about monetizing open source software using paid support services and providing value-added enhancements. Read the article to find out how others are successfully doing it.
5 ways of forwarding your work to some other object in Ruby
How often do you need to delegate methods in Ruby? Do you remember the API to do that? How many ways are out there to do it? Find the answers:
Event Store's pagination
Stream pagination in Greg’s Event Store
Pi 4 ways with Ruby
I recorded this a couple of weeks ago, based on examples I showed my high school class on how to calculate the value of pi. This shows 4 different algorithms for calculating pi in Ruby. There is an accompanying github project so you can run all the code yourself. [more inside]
Different Collection Types in Ruby
A basic overview of collection types available to you in Ruby.
Attestor
Validations and policies for immutable Ruby objects. [more inside]
Display information about a method's parameters
The debugging gem has reached 1.1.0 and now includes a howtocall method: def function(a, b=1, c: 2, d:,&e) end [more inside]
gem install sub_diff
Inspect the changes of your String#sub and String#gsub replacements: https://github.com/shuber/sub_diff
Rubyists - are you doing ETL unknowingly?
I just launched a new blog where I’ll share recipes and patterns to process data with Ruby. [more inside]
Work on exercism.io together with Katrina Owen at ROSS Conf
ROSS Conf Vienna is a one day mini-conference bringing Open Source Software maintainers and developers together in one room. The projects participating in its first edition include exercism.io from Katrina Owen and RVM from Michal Papis. In the morning bit the project owners will introduce their projects and share what would need work in the afternoon hackathon-y part. Access is free, we ask for a deposit that you’ll get back upon attendance. [more inside]
Write a simple template engine in 30 lines of code
Many template libraries are hundreds or thousands of lines of code. I break the problem down step by step and show you that you can build your own template engine in just a few lines of code.
Boolean2
Next time before you define a global Boolean constant, which might break other libraries, consider to just go with Boolean2. Simple, but useful.
Go beyond the easy fix with code archaeology
When you go bugfixing, the quick, obvious change isn’t always the best one. And the code in front of you is never the whole story. To go beyond the easy fix, you have to understand the history behind the code. And there are three great ways to learn what you need to know to confidently change code.
gem install variables
Variable objects for class and instance variables: https://github.com/shuber/variables
How to Create a simple Jekyll-like blog in your Rails 4 app – Nuts & Bolts #1
When I needed a company blog, I had a hard time deciding if I should use Jekyll, a Rails blog engine, or just build a simple blog functionality on my own. I implemented my own, see why and how.
The Minitest Cookbook
Have you been struggling to learn to test with Minitest? The Minitest Cookbook might just be what you’ve been looking for.
Chewy 0.7.0 is out
Chewy 0.7.0 is finally out! Index update strategies were completely reworked, default type scope is used in import to restrict result imported documents scope, class methods of indexes and types acts as named scopes, and more convenient and useful changes. Changelog
Using Docker to Parallelize Rails Tests
This article by Nick Gauthier explains how to parallelize your Rails tests by isolating them in Docker Containers. [more inside]
Fun with rails has_one :through association
Lately I had the chance to experiment a bit with the has_one :through association, here’s a recap of what I found
Observer pattern in 3 languages - Ruby, C# and Elixir
Typed up a blog post about Observer pattern implemented in three languages: