Sha256: 809e887bc60f6af588826569032e66a2cce85067c7ecedee7bd413ee055b5861

Contents?: true

Size: 982 Bytes

Versions: 12

Compression:

Stored size: 982 Bytes

Contents

require 'rdoc/code_object'

##
# A Module include in a class with \#include

class RDoc::Include < RDoc::CodeObject

  ##
  # Name of included module

  attr_accessor :name

  ##
  # Creates a new Include for +name+ with +comment+

  def initialize(name, comment)
    super()
    @name = name
    self.comment = comment
  end

  ##
  # Includes are sorted by name

  def <=> other
    return unless self.class === other

    name <=> other.name
  end

  def == other # :nodoc:
    self.class == other.class and
      self.name == other.name
  end

  ##
  # Full name based on #module

  def full_name
    m = self.module
    RDoc::ClassModule === m ? m.full_name : @name
  end

  def inspect # :nodoc:
    "#<%s:0x%x %s.include %s>" % [
      self.class,
      object_id,
      parent_name, @name,
    ]
  end

  ##
  # Attempts to locate the included module object.  Returns the name if not
  # known.

  def module
    RDoc::TopLevel.find_module_named(@name) || @name
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rdoc-2.5.11 lib/rdoc/include.rb
rdoc-2.5.10 lib/rdoc/include.rb
rdoc-2.5.9 lib/rdoc/include.rb
rdoc-2.5.8 lib/rdoc/include.rb
rdoc-2.5.7 lib/rdoc/include.rb
rdoc-2.5.6 lib/rdoc/include.rb
rdoc-2.5.5 lib/rdoc/include.rb
rdoc-2.5.4 lib/rdoc/include.rb
rdoc-2.5.3 lib/rdoc/include.rb
rdoc-2.5.2 lib/rdoc/include.rb
rdoc-2.5.1 lib/rdoc/include.rb
rdoc-2.5 lib/rdoc/include.rb