Working As Intended

Finding the source code for a Ruby method.

February 11th 2015

Today I discovered Ruby’s Method#source_location. I was getting strange results in a test case and wanted to see what was going on inside of xhr.

I added a breakpoint to my test.

xhr :get, :show, id:

And then in the console that came up from running the test I was able to pull up the file and line number for this method.

(byebug) self.method(:xhr).source_location
["/[...]/gems/actionpack-4.2.0/lib/action_controller/test_case.rb", 538]

The Clojure - Elixir Pendulum

February 8th 2015

As I’ve written before I’ve been alternating between Clojure and Elixir on my hobby projects. I did briefly dip into Scala for an online class on functional programming, and while it was interesting I realized that there was no chance I was going to stick with that language for the long term.

My latest reason for switching (in this case from Elixir back to Clojure) is that I can’t be bothered to write roles authorization code from scratch for the umpteenth time. I could (should perhaps) start a roles library project for Elixir and attempt to solve the problem for myself and others. But I’d much rather get something interesting done.

A likely upcoming scenario will be me getting annoyed at either (1) trying to hack Clojure code with vim or (2) realizing that the Clojure roles libraries like friend are as obnoxious as making my own in the first place. Friend might be wonderful; who knows.

Elixir is Back on the Radar

January 30th 2015

Over the past few years I’ve waffled between languages that I use for hobby projects, mainly bouncing between Clojure and Elixir. I’ve been screwing around with Elixir for the past month again, and now I’m really excited because of the possibility of running this on a Raspberry Pi. I don’t have anything resembling a goal in mind, but seeing a presentation about Erlang on the RPi got me excited.

I suspect that the first semi-real project will be something homebrewing related. Fermentation temperature monitoring perhaps? I realize that adding Elixir to the mix for something that simple is just overhead, but it might be a fun project anyway.

It’s getting me to dust off the electronics knowledge that I’ve completely forgotten in the 20 years since college, so that’s a bonus.


Feed Feed