Sha256: 2ee25eea69792f3dde81a7733fe8e0b3c3c813eebfec3f4c30cfe66d69316b30

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

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

      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(String) }
      # Returns a human-readable brief string description of this module.
      # @return [String]
      def describe
        "Module #{name} - #{children.length} " +
          "children, #{includes.length} includes, #{extends.length} extends"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
parlour-6.0.1 lib/parlour/rbs_generator/module_namespace.rb
parlour-6.0.0 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.6 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.5 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.4 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.3 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.2 lib/parlour/rbs_generator/module_namespace.rb
parlour-5.0.0.beta.1 lib/parlour/rbs_generator/module_namespace.rb