Skip to content

Instantly share code, notes, and snippets.

@aberant
Created July 3, 2012 21:10
Show Gist options
  • Save aberant/3043167 to your computer and use it in GitHub Desktop.
Save aberant/3043167 to your computer and use it in GitHub Desktop.
horrible.rb
# this only works in 1.8
module People
extend self
def self.base
Object
end
end
module Muteable
def self.append_features(klass)
klass.instance_eval "class << klass;" \
"attr_accessor :mute;" \
"end"
end
end
class Bob < People::base
include Muteable
def speak
unless(Bob::mute): method(:puts)[DATA.read] end
end
end
bob = Bob.new
bob.speak
Bob::mute = true
bob.speak
__END__
hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment