Created
December 25, 2010 20:39
-
-
Save sgharms/755036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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