Skip to content

Instantly share code, notes, and snippets.

@mcgain
Created September 10, 2012 23:22
Show Gist options
  • Select an option

  • Save mcgain/3694734 to your computer and use it in GitHub Desktop.

Select an option

Save mcgain/3694734 to your computer and use it in GitHub Desktop.
Ruby create class method
def create_class(class_name, superclass, &block)
klass = Class.new superclass, &block
Object.const_set class_name.to_s, klass
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment