Issue #8: Uses for Modules (1 of 4) 2011-04-13 18:00, written by Gregory Brown Originally published as part of the Practicing Ruby newsletter on December 8, 2010. Most of these issues draw inspiration from discussions and teaching sessions at my free online school, Ruby Mendicant Univ...
When using inheritance like this you are wasting resources (a class in this case) and so far I see only one advantage: changing the constructor is a bit easier because the old implementation is available via super without having to resort to alias or reimplementing member initializati...
Welcome, Hacker News folks. If you find the following project worthwhile, I’d really appreciate an up vote so that I can reach a broader audience. Please read a bit about Ruby Mendicant University to see what cause this goes to support. Since the first Ruby Mendicant University sessio...
Update: I came across an inlink to this page that was layering in advertisements in a frame. Luckily, there are technical solutions to at least some social problems, and you may now browse again in peace :) If you’ve worked with Ruby for at least a little while, you might already know...
# Users of older Rubies may want to use Process::RLIMIT_CPU # instead of :CPU in this code. soft, hard = Process.getrlimit(:CPU) last_update = Time.now max_cpu_time = 5 # this signal handler runs once we've hit max_cpu_time: trap(:XCPU) do # Calculate CPU utilization based on elapsed ...
Today, we’ll focus on the question that caused me to write this series in the first place. Many readers were confused by my use of extend self within earlier Practicing Ruby articles, and this lead to a number of interesting questions on the mailing list at the time these articles wer...
Issue #21: How to practice (1 of 2) 2011-09-06 16:00, written by Gregory Brown Originally published as part of the first volume of the Practicing Ruby newsletter on January 22, 2011. Most of these issues draw inspiration from discussions and teaching sessions at my free online school,...
The last few weeks have been a wild ride. Starting in January, I’ve been releasing a chapter at a time here on the RBP blog, and many of those chapters were pretty well commented on. Just for the sake of completeness, here’s a link back to each of those posts: Chapter 1: Driving Code ...
USP: Implementing signal handlers - some caveats 2012-03-27 00:25, written by Eric Wong Signal handlers may run at any time If your program receives a signal, Ruby will invoke the associated signal handler as soon as it is able to. This means a signal handler can hijack your existing ...
So even if we label all methods that accept a block as iterators, we know the story runs deeper than that. With this in mind, we can leverage some basic techniques to utilize any of the approaches shown here, as well as some more advanced tricks. By doing things in a way that is consi...
Rails Modularity for Lazy Bastards 2009-04-16 04:31, written by Gregory Brown When we develop standalone systems or work on libraries and frameworks, modularity seems to come naturally. When something seems to gain a life of its own, we pull it off into its own package or subsystem to...
Practicing Ruby's second volume now freely available 2012-03-26 14:00, written by Gregory Brown Keeping with my promise to release content from my Practicing Ruby journal , I’ve put together a massive link dump of articles from its second volume. Please enjoy them and share them with ...
If you haven’t watched Jim’s talk yet, I’ll remind you to go ahead and do that now. But assuming for some reason you can’t or won’t, you should know that the kinds of complexity that connascence can be used to reason about typically have something to do with coupling. The relationship...
Eric Wong 's Posts ( feed ) USP: Unix processes and their attributes Today Eric presents various bits of information that the kernel manages for a process. 2011-11-11 22:37 (View Comments ) USP: IO#dup and the dup(2) system call Eric explains duplicating file descriptors. 2011-10-19 0...
2009-06-27 16:00, written by Gregory Brown As promised, we’re back with more design discussion and hopefully some interesting ideas. Let’s start with a quick recap of what has happened so far. First, Sandi Metz posted on her blog about type specific coupling that a case statement can ...
##Concrete Implementations class BasicTimeData def initialize(hour, minutes) @hour = hour @minutes = minutes end def formatted_output "Time is #{@hour}:#{@minutes}" end end class TimeWithMeridianData def initialize(hour, minutes, meridian) @hour = hour @minutes = minutes @meridian = m...
This is a reasonable question to ask, because this approach is just as straightforward and has similar strengths and weaknesses. If Ruby did not have an open class system, you could argue that it’s less likely that you’d run into side effects with different definitions of SimpleLogger...