Class: Collie::Formatter::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/collie/formatter/options.rb

Overview

Formatting options

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = fetch_option(config, :indent_size, 2)
  @align_tokens = fetch_option(config, :align_tokens, true)
  @align_alternatives = fetch_option(config, :align_alternatives, true)
  @blank_lines_around_sections = fetch_option(config, :blank_lines_around_sections, 1)
  @max_line_length = fetch_option(config, :max_line_length, 120)
end

Instance Attribute Details

#align_alternativesObject

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_tokensObject

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_sectionsObject

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_sizeObject

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_lengthObject

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