background preloader

Ruby

Facebook Twitter

Practicing Ruby's second volume now freely available. 16: Interesting Ruby Hackers. Originally published as part of the Practicing Ruby newsletter on January 3, 2011.

16: Interesting Ruby Hackers

Most of these issues draw inspiration from discussions and teaching sessions at my free online school, Mendicant University. You should follow @seacreature on twitter if you want to keep up with my more recent projects. In this article, I’ve listed five people worth knowing about if you’re involved in Ruby. If you’re reading this in July 2011, please note that I wrote this article over 7 months ago, and so the descriptions you see below are slightly outdated.

That having been said, I still think these five people are on the top of my list when it comes to interesting folks in our community. Wayne Seguin (@wayneeseguin) Wayne gave us RVM, the Ruby enVironment Manager. In addition to basic version switching, RVM provides gemsets which are sandboxes for your gem installation environment. Another thing that is amazing about RVM is the amount of support Wayne offers for it. Rubeque. Elementary strings assert_equal ' HELLO WORLD ' , ' hello world ' .___ Back to Problems.

Rubeque

Rake Tutorial. If you’re developing with Rails you’ve probably encountered rake once or twice.

Rake Tutorial

This blog post aims to walk you through where rake came from and an introduction on how to use it effectively in your Rails apps. A Little Bit of History Rake is the project of Jim Weirich. It’s a build tool. For a good laugh and an even more in depth history check out the "rational.rdoc" from the Rake documentation. What’s the need for an automated build system at all? Historically, developers used build automation to call compilers and linkers from inside a build script versus attempting to make the compiler calls from the command line.

Ruby Patterns from GitHub's Codebase. Ruby Fleebie. Fun with Ruby Block Parameters. I always forget what kinds of crazy things you can do with Ruby's blocks and their parameters, so here's a little write-up on them.

Fun with Ruby Block Parameters

I regularly forget things I've learned (must be an age thing), and I found that not even books on the Ruby language fully cover all the gory details on block (and method) parameters. So consider this my personal reference of crazy Ruby block syntax features for future use. The Basics In its simplest form, a block parameter is a list of names, to which values passed into the block are assigned. The following iterates over all elements in the hash, emitting key and the corresponding value, printing both key and value. Yes, that's the boring bit, bear with me.

Splat Parameters You can use splat parameters too, catching an array of all arguments. blk = ->(*args) {puts args} blk.(1, 2, 3) # => [1, 2, 3] Notice that crazy syntax for calling the block too, pretty wild. Blk = ->(first, *tail) {puts first} blk.(1, 2, 3) # => 1. Linting the hell out of your Ruby classes with Pelusa. As you might know, yesterday morning we had Monday talks at the office!

Linting the hell out of your Ruby classes with Pelusa

Oriol talked about Object Oriented Nirvana, inspired by an old post about how to improve Object Oriented skills by using certain constraints while you're coding. Then I got immediately interested on how to automate this, and knowing how easy is dealing with the Rubinius' Abstract Syntax Tree, I decided to give it a try and develop a tool that statically analyzes Ruby code to gain insights from it. But what does it mean "statical analysis"? It means that this tool won't run any of your code at all, it just inspects it like you would as a developer, by looking at it. Since code is nothing more than nodes inside nodes, you can easily identify certain patterns that you consider wrong or desirable (for example, having else clauses in ifs, nesting blocks, or just using the word "foo" in actual programs).

Introducing Pelusa - a Ruby Lint to improve your OO skills Find the default lint checks too Taliban for your tastes? Ruby Trick Shots: A Video of 24 Ruby Tips and Tricks. Advanced Ruby Arrays. From Techotopia Purchase and download the PDF and ePub versions of this Ruby eBook for only $8.99 In the Understanding Ruby Arrays we looked at the basics of arrays in Ruby.

Advanced Ruby Arrays

In this chapter we will look at arrays in more detail. [edit] Combining Ruby Arrays Arrays in Ruby can be concatenated using a number of different approaches. Days1 = ["Mon", "Tue", "Wed"] days2 = ["Thu", "Fri", "Sat", "Sun"] days = days1 + days2 => ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] Alternatively, the concat method may be called: days1 = ["Mon", "Tue", "Wed"] days2 = ["Thu", "Fri", "Sat", "Sun"] days = days1.concat(days2) Elements may also be appended to an existing array using the << method.

Library. Ruby Inside: The Ruby Blog. Programming Ruby: The Pragmatic Programmer's Guide.

Rails