Sha256: d451fdd44bd581b02fa355b88b4da697487c68232f276d1a14f0b67b7d75a93d

Contents?: true

Size: 377 Bytes

Versions: 1

Compression:

Stored size: 377 Bytes

Contents

module Kernel #:nodoc:
  # This method is implemented to dynamically generate class with given name and template.
  # Referenced from {Ruby China}[https://ruby-china.org/topics/17382]
  def define_class(name, ancestor = Object)
    Object.const_set(name, Class.new(ancestor))
    Object.const_get(name).class_eval(&Proc.new) if block_given?
    Object.const_get(name)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-midori-0.0.5 lib/em-midori/define_class.rb