class HtmlToHaml::NonHtmlSelectorBlocks::IndentationTracker

Attributes

adjust_whitespace[R]
indented[R]

Public Class Methods

new(indented:, adjust_whitespace:) click to toggle source
# 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

Public Instance Methods

adjust_whitespace?(reset_value: adjust_whitespace) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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