Sha256: be41a363a5840ddce9b417d73c579e5d3462c6138b5a54649fce5bd2f03990a2

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

# typed: true
module Parlour
  class RbsGenerator < Generator
    # Represents a module definition.
    class ModuleNamespace < Namespace
      extend T::Sig

      Child = type_member {{ fixed: RbsObject }}

      sig do
        override.params(
          indent_level: Integer,
          options: Options
        ).returns(T::Array[String])
      end
      # Generates the RBS lines for this module.
      #
      # @param indent_level [Integer] The indentation level to generate the lines at.
      # @param options [Options] The formatting options to use.
      # @return [Array<String>] The RBS lines, formatted as specified.
      def generate_rbs(indent_level, options)        
        lines = generate_comments(indent_level, options)
        lines << options.indented(indent_level, "module #{name}")
        lines += generate_body(indent_level + 1, options)
        lines << options.indented(indent_level, "end")
      end

      sig { override.returns(T::Array[T.any(Symbol, T::Hash[Symbol, String])]) }
      def describe_attrs
        [:children]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parlour-9.0.0 lib/parlour/rbs_generator/module_namespace.rb
parlour-8.1.0 lib/parlour/rbs_generator/module_namespace.rb
parlour-8.0.0 lib/parlour/rbs_generator/module_namespace.rb
parlour-7.0.0 lib/parlour/rbs_generator/module_namespace.rb