Class: Parlour::Generator

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/parlour/generator.rb

Direct Known Subclasses

RbiGenerator, RbsGenerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(break_params: 4, tab_size: 2, sort_namespaces: false) ⇒ void

Creates a new generator.

Parameters:

  • break_params (Integer) (defaults to: 4)

    If there are at least this many parameters in a signature, then it is broken onto separate lines.

  • tab_size (Integer) (defaults to: 2)

    The number of spaces to use per indent.

  • sort_namespaces (Boolean) (defaults to: false)

    Whether to sort all items within a namespace alphabetically.



15
16
17
18
19
20
21
# File 'lib/parlour/generator.rb', line 15

def initialize(break_params: 4, tab_size: 2, sort_namespaces: false)
  @options = Options.new(
    break_params: break_params,
    tab_size: tab_size,
    sort_namespaces: sort_namespaces
  )
end

Instance Attribute Details

#current_pluginPlugin?

The plugin which is currently generating new definitions. Plugin.run_plugins controls this value.

Returns:



32
33
34
# File 'lib/parlour/generator.rb', line 32

def current_plugin
  @current_plugin
end

#optionsOptions (readonly)

The formatting options for this generator. Currently ignored.

Returns:



26
27
28
# File 'lib/parlour/generator.rb', line 26

def options
  @options
end