Class: Rucoa::Yard::DefinitionGenerators::ModuleDefinitionGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/rucoa/yard/definition_generators/module_definition_generator.rb

Direct Known Subclasses

ClassDefinitionGenerator

Instance Method Summary collapse

Methods inherited from Base

call, #initialize

Constructor Details

This class inherits a constructor from Rucoa::Yard::DefinitionGenerators::Base

Instance Method Details

#callObject

Examples:

returns module definition for module node

definitions = Rucoa::Source.new(
  content: <<~RUBY,
    module Foo
    end
  RUBY
  uri: '/path/to/foo.rb'
).definitions
expect(definitions[0]).to be_a(Rucoa::Definitions::ModuleDefinition)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rucoa/yard/definition_generators/module_definition_generator.rb', line 16

def call
  return [] unless @node.is_a?(Nodes::ModuleNode)

  [
    Definitions::ModuleDefinition.new(
      description: description,
      extended_module_unqualified_names: extended_module_unqualified_names,
      included_module_unqualified_names: included_module_unqualified_names,
      location: location,
      prepended_module_unqualified_names: prepended_module_unqualified_names,
      qualified_name: @node.qualified_name
    )
  ]
end