Class: HtmlToHaml::NonHtmlSelectorBlocks::IndentationTracker
- Inherits:
-
Object
- Object
- HtmlToHaml::NonHtmlSelectorBlocks::IndentationTracker
- Defined in:
- lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb
Instance Attribute Summary collapse
-
#adjust_whitespace ⇒ Object
readonly
Returns the value of attribute adjust_whitespace.
-
#indented ⇒ Object
readonly
Returns the value of attribute indented.
Instance Method Summary collapse
- #adjust_whitespace?(reset_value: adjust_whitespace) ⇒ Boolean
- #indent ⇒ Object
-
#initialize(indented:, adjust_whitespace:) ⇒ IndentationTracker
constructor
A new instance of IndentationTracker.
- #outdent ⇒ Object
Constructor Details
#initialize(indented:, adjust_whitespace:) ⇒ IndentationTracker
Returns a new instance of IndentationTracker.
6 7 8 9 10 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 6 def initialize(indented:, adjust_whitespace:) @indented = indented @reset_adjust_whitespace = false @adjust_whitespace = adjust_whitespace end |
Instance Attribute Details
#adjust_whitespace ⇒ Object (readonly)
Returns the value of attribute adjust_whitespace.
4 5 6 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 4 def adjust_whitespace @adjust_whitespace end |
#indented ⇒ Object (readonly)
Returns the value of attribute indented.
4 5 6 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 4 def indented @indented end |
Instance Method Details
#adjust_whitespace?(reset_value: adjust_whitespace) ⇒ Boolean
25 26 27 28 29 30 31 32 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 25 def adjust_whitespace?(reset_value: adjust_whitespace) if @reset_adjust_whitespace @reset_adjust_whitespace = false @adjust_whitespace = reset_value else @adjust_whitespace end end |
#indent ⇒ Object
12 13 14 15 16 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 12 def indent return if indented @indented = true @reset_adjust_whitespace = true end |
#outdent ⇒ Object
18 19 20 21 22 23 |
# File 'lib/html_to_haml/tools/non_html_selector_blocks/indentation_tracker.rb', line 18 def outdent return unless indented @indented = false @adjust_whitespace = false @reset_adjust_whitespace = false end |