# Ruby for Canadians: an instruction manual

DevFeed: [Ruby for Canadians: an instruction manual](<https://devfeed.tech/articles/ruby-for-canadians-an-instruction-manual-35542.md>)

Original publisher: [Read original article](<https://meowni.ca/posts/ruby-eh/>)

Author: Monica Dinculescu

Published: 2014-02-25T00:00:00Z

Content type: tutorial

Language: en

Sources: [Monica Dinculescu](<https://devfeed.tech/sources/monica-dinculescu.md>)

Topics: [Ruby](<https://devfeed.tech/topics/ruby.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Code](<https://devfeed.tech/topics/code.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [iteration](<https://devfeed.tech/topics/iteration.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [exception](<https://devfeed.tech/tags/exception.md>), [function](<https://devfeed.tech/tags/function.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [module](<https://devfeed.tech/tags/module.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-languages](<https://devfeed.tech/tags/programming-languages.md>), [ruby](<https://devfeed.tech/tags/ruby.md>)

## AI overview

A humorous Ruby article demonstrates open classes, method aliases, localized method names, Canadian slang, Unicode identifiers, and bare-word function names. It uses code examples to show how Ruby's flexibility enables these unconventional techniques.

## Source excerpt

One of the hardships about being Canadian is that most programming languages are quite simply, rude. Descriptions like 'imperative' and 'declarative' are enough to fill even the most impolite of Canadians with a vague sense of discomfort. Fear no more! Ruby is the sort of language that addresses all these concerns, and adds a familiar, maple-syrupy feel to your code. Here are the codes, for your perusal. There's no such thing as 'too polite' Ruby lets you open your classes and teach your fellow programmers some basic manners: class Object def please self end alias_method :eh, :please alias_method :eh?, :please alias_method :pardon, :please alias_method :pardon?, :please end module Kernel alias_method :sane_puts, :puts alias_method :giver, :puts def puts(s) sane_puts "If you don't mind, " + s end end Now you can write correct and civilized code like you've always wanted: giver "maple syrup".please.reverse.eh? # If you don't mind, purys elpam Don't forget about Quebec Ruby is the first language to pioneer French as the one true language. We have translated all the methods in Array and stored them in a dictionary called translations, that contains entries of the form :english_foo => :french_foo. A small iteration, class Array Array.instance_methods(false).each do |f| if translations.key?(f) alias_method translations[f], f end end end And we can write glorious code that would make Quebec proud def articles_aleatoires(matrice) matrice.echantillon(1 + rand(matrice.compte)) end articles_aleatoires [1,2,3,4,5] # => [1, 2] Canadian slang Fans of Bob and Doug McKenzie can breathe a sigh of relief to know that Ruby speaks the language of the Great White North, eh? class Exception alias :sane_to_s :to_s def to_s sane_to_s + ". Take off, hoser." end end # >> raise ArgumentError # ArgumentError: uncaught throw ArgumentError. Take off, hoser. Digression for non-Canadians Of course, you can use this idea of open classes for truly magical features. Good code is nothing if not mildly