Class: SketchUpYARD::Stubs::AutoLoadGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/yard-sketchup/stubs/autoload.rb

Defined Under Namespace

Classes: Node, NodeFactory

Instance Method Summary collapse

Instance Method Details

#generate(namespace_objects, out) ⇒ Object

Parameters:

  • namespace_objects (YARD::CodeObject::Base)
  • out (IO)


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/yard-sketchup/stubs/autoload.rb', line 7

def generate(namespace_objects, out)
  dependencies = resolve_dependencies(namespace_objects)
  out.puts "# This file is auto-generated by the `thor stubs` command."
  required = Set.new
  # Top level is special case.
  top_level_path = File.join(sketchup_stubs_path, '_top_level.rb')
  out.puts "require '#{top_level_path}'"
  # The rest is resolved recursively.
  dependencies.each { |object|
    recurse_require(object, required, out)
  }
end