Skip to content

Instantly share code, notes, and snippets.

@Nimster
Nimster / ringbuffer.rb
Created November 15, 2012 11:21 — forked from eerohele/ringbuffer.rb
A simple ring buffer for Ruby.
class RingBuffer < Array
attr_reader :max_size
def initialize(max_size, enum = nil)
@max_size = max_size
enum.each { |e| self << e } if enum
end
def <<(el)
if self.size < @max_size || @max_size.nil?
@Nimster
Nimster / Rakefile
Created September 16, 2011 20:34 — forked from jamiecobbett/Rakefile
Run a rake task for each rakefile in directories under the current one
# Adapted from http://stackoverflow.com/questions/1686779/multifile-rake-build
# Runs a task (in this case the default task) for each Rakefile nested in the current directory
task :default do
FileList["*/**/Rakefile"].each do |project|
next if project =~ /^admin_console/
next if project =~ /^logging/
# clear current tasks
Rake::Task.clear
#load tasks from this project
load project