Skip to content

Instantly share code, notes, and snippets.

@sgharms
Created December 25, 2010 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgharms/755036 to your computer and use it in GitHub Desktop.
Save sgharms/755036 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def amethod
myArray = %w/foo bar bin bat/
m = Module.new do
attr_reader :var1
def initialize
@var1 = "Lauren Monkey"
puts "I just ran initialize"
end def razzle
puts "you have been razzled"
end
end
m.module_eval do
myArray.each do |m|
define_method m.to_sym do puts "Auto generated: #{m}"
end
end
end
m
end
class Zazzle
include amethod
def mchobo
puts "Would you like to mchobo"
end
class << self
def lazybones
puts "Some days we are lazy"
end
end
end
z = Zazzle.new
z.razzle
z.foo
puts "printing this out #{z.var1}"
z.mchobo
Zazzle.lazybones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment