Class: Parlour::RbsGenerator::InterfaceNamespace

Inherits:
Namespace show all
Extended by:
T::Sig
Defined in:
lib/parlour/rbs_generator/interface_namespace.rb

Overview

Represents an interface definition.

Constant Summary collapse

Child =
type_member {{ fixed: RbsObject }}

Instance Attribute Summary

Attributes inherited from Namespace

#children

Attributes inherited from RbsObject

#generator

Attributes inherited from TypedObject

#comments, #generated_by, #name

Instance Method Summary collapse

Methods inherited from Namespace

#add_comment_to_next_child, #aliases, #constants, #create_arbitrary, #create_attr_accessor, #create_attr_reader, #create_attr_writer, #create_attribute, #create_class, #create_constant, #create_extend, #create_extends, #create_include, #create_includes, #create_interface, #create_method, #create_module, #create_type_alias, #extends, #includes, #initialize, #merge_into_self, #mergeable?, #path

Methods included from Mixin::Searchable

#children, #find, #find_all

Methods inherited from RbsObject

#initialize, #merge_into_self, #mergeable?

Methods inherited from TypedObject

#add_comment, #describe, #describe_tree, #initialize

Constructor Details

This class inherits a constructor from Parlour::RbsGenerator::Namespace

Instance Method Details

#describe_attrsObject



29
30
31
# File 'lib/parlour/rbs_generator/interface_namespace.rb', line 29

def describe_attrs
  [:children]
end

#generate_rbs(indent_level, options) ⇒ Array<String>

Generates the RBS lines for this interface.

Parameters:

  • indent_level (Integer)

    The indentation level to generate the lines at.

  • options (Options)

    The formatting options to use.

Returns:

  • (Array<String>)

    The RBS lines, formatted as specified.



21
22
23
24
25
26
# File 'lib/parlour/rbs_generator/interface_namespace.rb', line 21

def generate_rbs(indent_level, options)        
  lines = generate_comments(indent_level, options)
  lines << options.indented(indent_level, "interface #{name}")
  lines += generate_body(indent_level + 1, options)
  lines << options.indented(indent_level, "end")
end