Skip to content

Instantly share code, notes, and snippets.

View s-andringa's full-sized avatar

Sjoerd Andringa s-andringa

View GitHub Profile
@s-andringa
s-andringa / constant_gardener.rb
Created December 28, 2010 15:38
Deal with bitmask-form options & Safely monkey patch Ruby gems
class ConstantGardener
def self.create(*booleans)
Class.new do
def initialize(bitmask)
@bitmask = bitmask
end
booleans.each_with_index do |b, i|
const_set b.to_s.upcase, 2**i