Skip to content

Instantly share code, notes, and snippets.

@robhanlon22
Forked from vogon/gist:2975094
Created June 22, 2012 20:56
Show Gist options
  • Save robhanlon22/2975121 to your computer and use it in GitHub Desktop.
Save robhanlon22/2975121 to your computer and use it in GitHub Desktop.
shit that doesn't work
module CLR
class MDTable
class << self
def dump
puts @schema
end
def word(name)
@schema << "word #{name};"
end
def index(tables, name)
@schema << "index #{tables}, #{name};"
end
private
def inherited(descendant)
descendant.instance_eval do
@schema = ''
end
end
end
end
ObjectSpace.each_object(MDTable.singleton_class).each do |klass|
remove_const klass.name.gsub(/^.*::/, '') if obj < MDTable
end
class Module < MDTable
word :generation
index :string, :name
index :guid, :mvid
index :guid, :encid
end
end
puts CLR::Module.dump
puts CLR::MDTable.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment