Class: Parlour::RbiGenerator
- Inherits:
-
Object
- Object
- Parlour::RbiGenerator
- Extended by:
- T::Sig
- Defined in:
- lib/parlour/rbi_generator.rb,
lib/parlour/rbi_generator/extend.rb,
lib/parlour/rbi_generator/method.rb,
lib/parlour/rbi_generator/include.rb,
lib/parlour/rbi_generator/options.rb,
lib/parlour/rbi_generator/constant.rb,
lib/parlour/rbi_generator/arbitrary.rb,
lib/parlour/rbi_generator/attribute.rb,
lib/parlour/rbi_generator/namespace.rb,
lib/parlour/rbi_generator/parameter.rb,
lib/parlour/rbi_generator/rbi_object.rb,
lib/parlour/rbi_generator/class_namespace.rb,
lib/parlour/rbi_generator/module_namespace.rb,
lib/parlour/rbi_generator/enum_class_namespace.rb
Overview
The RBI generator.
Direct Known Subclasses
Defined Under Namespace
Classes: Arbitrary, Attribute, ClassNamespace, Constant, EnumClassNamespace, Extend, Include, Method, ModuleNamespace, Namespace, Options, Parameter, RbiObject
Instance Attribute Summary collapse
-
#current_plugin ⇒ Plugin?
The plugin which is currently generating new definitions.
-
#options ⇒ Options
readonly
The formatting options for this generator.
-
#root ⇒ Namespace
readonly
The root Namespace of this generator.
Instance Method Summary collapse
-
#initialize(break_params: 4, tab_size: 2, sort_namespaces: false) ⇒ void
constructor
Creates a new RBI generator.
-
#rbi(strictness = 'strong') ⇒ String
Returns the complete contents of the generated RBI file as a string.
Constructor Details
#initialize(break_params: 4, tab_size: 2, sort_namespaces: false) ⇒ void
Creates a new RBI generator.
22 23 24 25 26 27 28 29 |
# File 'lib/parlour/rbi_generator.rb', line 22 def initialize(break_params: 4, tab_size: 2, sort_namespaces: false) = Options.new( break_params: break_params, tab_size: tab_size, sort_namespaces: sort_namespaces ) @root = Namespace.new(self) end |
Instance Attribute Details
#current_plugin ⇒ Plugin?
The plugin which is currently generating new definitions. Plugin.run_plugins controls this value.
45 46 47 |
# File 'lib/parlour/rbi_generator.rb', line 45 def current_plugin @current_plugin end |
#options ⇒ Options (readonly)
The formatting options for this generator.
34 35 36 |
# File 'lib/parlour/rbi_generator.rb', line 34 def end |
Instance Method Details
#rbi(strictness = 'strong') ⇒ String
Returns the complete contents of the generated RBI file as a string.
51 52 53 |
# File 'lib/parlour/rbi_generator.rb', line 51 def rbi(strictness = 'strong') "# typed: #{strictness}\n" + root.generate_rbi(0, ).join("\n") + "\n" end |