Class: HtmlToHaml::Html::ConversionUseCase

Inherits:
Object
  • Object
show all
Defined in:
lib/html_to_haml/use_cases/html/conversion_use_case.rb

Instance Method Summary collapse

Constructor Details

#initialize(html, remove_whitespace: true) ⇒ ConversionUseCase

Returns a new instance of ConversionUseCase.



8
9
10
11
# File 'lib/html_to_haml/use_cases/html/conversion_use_case.rb', line 8

def initialize(html, remove_whitespace: true)
  @html = html
  @remove_whitespace = remove_whitespace
end

Instance Method Details

#convertObject



13
14
15
16
17
# File 'lib/html_to_haml/use_cases/html/conversion_use_case.rb', line 13

def convert
  html_with_haml_comments = CommentConversionUseCase.new(@html).convert
  haml = DefaultConversionUseCase.new(html_with_haml_comments, remove_whitespace: @remove_whitespace).convert
  AttributeConversionUseCase.instance.convert_attributes(html: haml)
end