add_class

add_class(class_type, given_name, superclass = '::Object')
Instance Public methods

Adds a class named given_name with superclass.

Both given_name and superclass may contain '::', and are interpreted relative to the self context. This allows handling correctly examples like these:

class RDoc::Gauntlet < Gauntlet
module Mod
  class Object   # implies < ::Object
  class SubObject < Object  # this is _not_ ::Object

Given class Container::Item RDoc assumes Container is a module unless it later sees class Container. add_class automatically upgrades given_name to a class in this case.

doc_ruby_on_rails
2015-05-01 16:16:20
Comments
Leave a Comment

Please login to continue.