Module: Simply::Indentation
- Defined in:
- lib/simply/indentation.rb
Defined Under Namespace
Classes: IndentationError
Constant Summary
collapse
- DEFAULT_NUM_SPACES_TO_INDENT =
2
- DEFAULT_INDENTATION_LEVEL =
0
Instance Method Summary
collapse
Instance Method Details
#<<(text) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/simply/indentation.rb', line 14
def <<(text)
out = empty? ? "" : "\n"
out << "#{" " * indentation_level}#{text}"
super(out)
end
|
#indent(number_of_spaces = DEFAULT_NUM_SPACES_TO_INDENT) ⇒ Object
#indentation_level ⇒ Object
33
34
35
|
# File 'lib/simply/indentation.rb', line 33
def indentation_level
@indentation_level ||= DEFAULT_INDENTATION_LEVEL
end
|
#outdent(number_of_spaces = DEFAULT_NUM_SPACES_TO_INDENT) ⇒ Object