Class: Parlour::RbsGenerator

Inherits:
Generator show all
Defined in:
lib/parlour/rbs_generator.rb,
lib/parlour/rbs_generator/block.rb,
lib/parlour/rbs_generator/extend.rb,
lib/parlour/rbs_generator/method.rb,
lib/parlour/rbs_generator/include.rb,
lib/parlour/rbs_generator/constant.rb,
lib/parlour/rbs_generator/arbitrary.rb,
lib/parlour/rbs_generator/attribute.rb,
lib/parlour/rbs_generator/namespace.rb,
lib/parlour/rbs_generator/parameter.rb,
lib/parlour/rbs_generator/rbs_object.rb,
lib/parlour/rbs_generator/type_alias.rb,
lib/parlour/rbs_generator/class_namespace.rb,
lib/parlour/rbs_generator/method_signature.rb,
lib/parlour/rbs_generator/module_namespace.rb,
lib/parlour/rbs_generator/interface_namespace.rb

Overview

The RBS generator.

Direct Known Subclasses

DetachedRbsGenerator

Defined Under Namespace

Classes: Arbitrary, Attribute, Block, ClassNamespace, Constant, Extend, Include, InterfaceNamespace, Method, MethodSignature, ModuleNamespace, Namespace, Parameter, RbsObject, TypeAlias

Instance Attribute Summary collapse

Attributes inherited from Generator

#current_plugin, #options

Instance Method Summary collapse

Constructor Details

#initialize(**hash) ⇒ RbsGenerator

Returns a new instance of RbsGenerator.



5
6
7
8
# File 'lib/parlour/rbs_generator.rb', line 5

def initialize(**hash)
  super
  @root = RbsGenerator::Namespace.new(self)
end

Instance Attribute Details

#rootNamespace (readonly)

The root Namespace of this generator.

Returns:



13
14
15
# File 'lib/parlour/rbs_generator.rb', line 13

def root
  @root
end

Instance Method Details

#rbsString

Returns the complete contents of the generated RBS file as a string.

Returns:

  • (String)

    The generated RBS file



19
20
21
# File 'lib/parlour/rbs_generator.rb', line 19

def rbs
  root.generate_rbs(0, options).join("\n")
end