class Parlour::Options
A set of immutable formatting options.
Attributes
If there are at least this many parameters in a signature, then it is broken onto separate lines.
# With break_params: 5 sig { params(name: String, age: Integer, hobbies: T::Array(String), country: Symbol).void } # With break_params: 4 sig do params( name: String, age: Integer, hobbies: T::Array(String), country: Symbol ).void end
@return [Integer]
Whether to sort all items within a namespace alphabetically. Items which are typically grouped together, such as “include” or “extend” calls, will remain grouped together when sorted. If true, items are sorted by their name when the RBI is generated. If false, items are generated in the order they are added to the namespace. @return [Boolean]
The number of spaces to use per indent. @return [Integer]
Private Class Methods
Creates a new set of formatting options.
@example Create Options
with break_params
of 4
and tab_size
of 2
.
Parlour::Options.new(break_params: 4, tab_size: 2)
@param break_params
[Integer] If there are at least this many parameters in a
signature, then it is broken onto separate lines.
@param tab_size
[Integer] The number of spaces to use per indent. @param sort_namespaces
[Boolean] Whether to sort all items within a
namespace alphabetically.
@return [void]
# File lib/parlour/options.rb, line 19 def initialize(break_params:, tab_size:, sort_namespaces:) @break_params = break_params @tab_size = tab_size @sort_namespaces = sort_namespaces end
Private Instance Methods
Returns a string indented to the given indent level, according to the set {tab_size}.
@param level [Integer] The indent level, as an integer. 0 is totally unindented. @param str [String] The string to indent. @return [String] The indented string.
# File lib/parlour/options.rb, line 67 def indented(level, str) " " * (level * tab_size) + str end