Class: Collie::Formatter::Options
- Inherits:
-
Object
- Object
- Collie::Formatter::Options
- Defined in:
- lib/collie/formatter/options.rb
Overview
Formatting options
Instance Attribute Summary collapse
-
#align_alternatives ⇒ Object
Returns the value of attribute align_alternatives.
-
#align_tokens ⇒ Object
Returns the value of attribute align_tokens.
-
#blank_lines_around_sections ⇒ Object
Returns the value of attribute blank_lines_around_sections.
-
#indent_size ⇒ Object
Returns the value of attribute indent_size.
-
#max_line_length ⇒ Object
Returns the value of attribute max_line_length.
Instance Method Summary collapse
- #indent(level = 1) ⇒ Object
-
#initialize(config = {}) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(config = {}) ⇒ Options
Returns a new instance of Options.
10 11 12 13 14 15 16 |
# File 'lib/collie/formatter/options.rb', line 10 def initialize(config = {}) @indent_size = config[:indent_size] || 2 @align_tokens = config[:align_tokens] != false @align_alternatives = config[:align_alternatives] != false @blank_lines_around_sections = config[:blank_lines_around_sections] || 1 @max_line_length = config[:max_line_length] || 120 end |
Instance Attribute Details
#align_alternatives ⇒ Object
Returns the value of attribute align_alternatives.
7 8 9 |
# File 'lib/collie/formatter/options.rb', line 7 def align_alternatives @align_alternatives end |
#align_tokens ⇒ Object
Returns the value of attribute align_tokens.
7 8 9 |
# File 'lib/collie/formatter/options.rb', line 7 def align_tokens @align_tokens end |
#blank_lines_around_sections ⇒ Object
Returns the value of attribute blank_lines_around_sections.
7 8 9 |
# File 'lib/collie/formatter/options.rb', line 7 def blank_lines_around_sections @blank_lines_around_sections end |
#indent_size ⇒ Object
Returns the value of attribute indent_size.
7 8 9 |
# File 'lib/collie/formatter/options.rb', line 7 def indent_size @indent_size end |
#max_line_length ⇒ Object
Returns the value of attribute max_line_length.
7 8 9 |
# File 'lib/collie/formatter/options.rb', line 7 def max_line_length @max_line_length end |
Instance Method Details
#indent(level = 1) ⇒ Object
18 19 20 |
# File 'lib/collie/formatter/options.rb', line 18 def indent(level = 1) " " * (indent_size * level) end |