articles tagged ruby

introducing active copy

If you've ever browsed the source code of this blog, you might have noticed a directory called lib/active_copy. Opening up that directory is somewhat interesting, as you'll be able to see exactly how I take Markdown files with YAML front matter and render them through ActionView. But unfortunately, unless you fork this repo and hack it to bits, you were unable to use ActiveCopy in your own Rails projects.

pv: a shell interface for pivotal tracker

At eLocal, we use the lovely Pivotal Tracker to track our work progress. It has a really great interface for viewing stories, and some additional features like tasks, rich text comments, and the ability to "predict" future iterations by using the velocity and "points" system (which is totally arbitrary). Another great feature is the story states, which are also arbitrary, but we use them for very specific purposes...for example, Delivered means the story has been placed on the stage server and is ready for testing, while Finished just means that I've pushed the code to master branch and it can be deployed at any time.

a case for scopes

There has been a lot of hate towards scopes recently. I'm here to tell you that scopes aren't all bad, and they can be used to create some astonishingly elegant model definitions.

don't make this simple mistake...

install bundler-1.3 before installing Ruby 2.0! That should downgrade RubyGems to a point that you can just do a gem install bundler to obtain 1.3. Once you begin installing gems with 1.3, everything in Ruby 2.0 will work out again.

minitest is still wonderful

So after posting my article on how to use assertions in rspec, I was involved in a discussion with @cheapRoc over the discovery that indeed assertions do work within the context of RSpec. To my surprise, it seemed @seattlerb was following at least one of us and overheard our conversation, mistaking my quite hyperbolic statement for a diss on Minitest.

how to bang...like a boss

In the Ruby programming language, there exists two characters you are only permitted to use when naming a method: ? and !. These special permissions are designed to allow you to establish a certain level of convention in your method naming, for example, a method ending in "?" in Ruby is mosty likely always going to return a Boolean response of true or false. Not only is this convention not questioned much, but there seems to be very little sensible use out of making a "?" method not return a boolean response. At eLocal, we use "!" as a generalized YOLO convention. It means we're about to execute some actions which may fail, or are connecting to an outside resource (such as an API or our mothership site) In either case, the "!" dictates that our app's control flow should stop.

use assertions in rspec

tl;dr -- you can do MiniTest::Assertions inside RSpec examples.

making private methods private

So it's a well-known Rubyism that you can actually circumvent private and protected restrictions on instance methods if you simply use the send() method to access them. I wanted to see if it was possible to rewrite send() on a particular class to throw an exception if the method attempting to be accessed was a private method on the class.

simplifying my ruby life

Ruby is all about simplicity. Make simple things simple, right? So how come we have to deal with all this complexity when we run Ruby? This is how I made my life slightly easier and got some really sweet benefits as a result.

meet blue_velvet

It's certainly been a while, hasn't it? I've been busy with gigs and vacation, so there's been little time to blog. I have been working on stuff...including the foundation of a record label (which I'll talk about in a future post) and maintaining the Wonder Bars' official website.

a new beginning

So here we go, another new layout and another re-hash of this blog's content. I threw away the last two iterations (still have the data, though) of this blog, because I was unsatisfied with the poor content on it. So let's start again.