Skip to content

Instantly share code, notes, and snippets.

@jamesgolick
Created April 28, 2009 20:35
Show Gist options
  • Select an option

  • Save jamesgolick/103386 to your computer and use it in GitHub Desktop.

Select an option

Save jamesgolick/103386 to your computer and use it in GitHub Desktop.
require 'mixico'
module Bytes
def self.mixin
Fixnum.send(:include, Bytes)
end
def self.mixout
Fixnum.send(:disable_mixin, Bytes)
end
def megabyte
1048576
end
end
def with(mod)
mod.mixin
yield
mod.mixout
end
with(Bytes) do
puts 1.megabyte
end
1.megabyte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment