public Method

Class.remove_class(*klasses)

There's no documentation for this item.

Source Code

# File active_support/core_ext/class/removal.rb, line 10
def remove_class(*klasses)
  klasses.flatten.each do |klass|
    # Skip this class if there is nothing bound to this name
    next unless defined?(klass.name)

    basename = klass.to_s.split("::").last
    parent = klass.parent

    # Skip this class if it does not match the current one bound to this name
    next unless parent.const_defined?(basename) && klass = parent.const_get(basename)

    parent.instance_eval { remove_const basename } unless parent == klass
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.