The Ruby Craftsman
Posts
-
ActiveMocker 2.6 Released
103rd release of ActiveMocker! See change log for details.
-
Refactoring Towards Immutable Objects in Ruby [Video]
Learn how to refactor from a mutable object into an immutable one while still being able to make changes to state. I’ll start with an Account class and show how you would let it emit new objects instead of changing the previous one. I walk step by step through the refactor process and talk about its possible advantages.
-
Freeze Ruby Constants [Video]
An intro video to Ruby constants their enforcement pitfalls and how to fix them and why you should care in your code.
-
Refactoring with Hash Defaults
I’m going to give you a primer on how to set default values when accessing non-existing keys. Then I’ll give you some advice on how this could improve your code.
-
Postgres Regex Parsing
For some reason a Ruby array of BigDecimals was being inserted into a String column in our Portgres DB. With a lot of trying out different things and some help from another software developer and DBA we came up with a solution to parse out the numbers. The goal was to convert a string of
["83000.0", "119000.0"]
to an PG array{83000.0, 119000.0}
. It Take some regex, but it’s doable.
subscribe via RSS