Module: YardClassmethods::Handler

Defined in:
lib/yard_classmethods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#yard_classmethods_moduleObject

Returns the value of attribute yard_classmethods_module


35
36
37
# File 'lib/yard_classmethods.rb', line 35

def yard_classmethods_module
  @yard_classmethods_module
end

Instance Method Details

#processObject


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/yard_classmethods.rb', line 37

def process
  super
  # Are we looking at a ClassMethods-style module.
  if yard_classmethods_module
    # Start object tree surgery.
    yard_classmethods_module.meths.each do |meth|
      if meth.name != :included
      # Build a new method object under the parent namespace and copy all data over.
        new_meth = register meth.class.new(namespace, meth.name, :module)
        meth.copy_to(new_meth)
      end
      meth.visibility = :private
    end
  end
end