The Ruby Craftsman

Posts

  • 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.

    Read more

  • 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.

    Read more

  • 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.

    Read more

  • 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.

    Read more

  • Why use ActiveMocker?

    959 Tests in 4.9 Seconds

    Read more

subscribe via RSS

Subscribe to my mailing list

* indicates required