Class: PuppetStrings::Yard::CodeObjects::Base

Inherits:
YARD::CodeObjects::NamespaceObject
  • Object
show all
Defined in:
lib/puppet-strings/yard/code_objects/base.rb

Overview

Implements the base code object.

Class Method Summary collapse

Class Method Details

.new(*args) {|object| ... } ⇒ Object

Allocates a new code object.

Parameters:

  • args (Array)

    The arguments to initialize the code object with.

Yields:

  • (object)

Returns:

  • Returns the code object.



8
9
10
11
12
13
14
15
# File 'lib/puppet-strings/yard/code_objects/base.rb', line 8

def self.new(*args)
  # Skip the super class' implementation because it detects :: in names and this will cause namespaces in the output we don't want
  object = Object.class.instance_method(:new).bind(self).call(*args)
  existing = YARD::Registry.at(object.path)
  object = existing if existing && existing.class == self
  yield(object) if block_given?
  object
end