Class: Code::Format
Constant Summary collapse
- INDENT =
" "- MAX_LINE_LENGTH =
80- MIN_WIDTH =
20- MAX_INLINE_STRING_LENGTH =
50- MAX_INLINE_COLLECTION_LENGTH =
40- MAX_INLINE_COLLECTION_ITEMS =
3- MAX_INLINE_CALL_ARGUMENTS_LENGTH =
80- MAX_INLINE_BLOCK_BODY_LENGTH =
40- CONTINUATION_PADDING =
4- BOOLEAN_WORD_OPERATORS =
%w[and or].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(parsed) ⇒ Format
constructor
A new instance of Format.
Constructor Details
#initialize(parsed) ⇒ Format
Returns a new instance of Format.
22 23 24 |
# File 'lib/code/format.rb', line 22 def initialize(parsed) @parsed = parsed || [] end |
Class Method Details
.format(parsed) ⇒ Object
17 18 19 |
# File 'lib/code/format.rb', line 17 def format(parsed) new(parsed).format end |
Instance Method Details
#format ⇒ Object
26 27 28 |
# File 'lib/code/format.rb', line 26 def format enforce_line_width(format_code(@parsed, indent: 0)) end |