Skip to content

Instantly share code, notes, and snippets.

@aberant
Created December 21, 2010 20:01
Show Gist options
  • Save aberant/750481 to your computer and use it in GitHub Desktop.
Save aberant/750481 to your computer and use it in GitHub Desktop.
how incomprehensible can i make this?
# 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