Class: HtmlBeautifier::Beautifier
- Inherits:
-
Object
- Object
- HtmlBeautifier::Beautifier
- Defined in:
- lib/htmlbeautifier/beautifier.rb
Instance Attribute Summary collapse
-
#tab_stops ⇒ Object
Returns the value of attribute tab_stops.
Instance Method Summary collapse
-
#initialize(output) ⇒ Beautifier
constructor
Create a new Beautifier.
-
#scan(html) ⇒ Object
Process an HTML/HTML+ERB document html should be a string.
Constructor Details
#initialize(output) ⇒ Beautifier
Create a new Beautifier. output should be an object that responds to << i.e. a String or an IO
11 12 13 14 |
# File 'lib/htmlbeautifier/beautifier.rb', line 11 def initialize(output) self.tab_stops = 2 @output = output end |
Instance Attribute Details
#tab_stops ⇒ Object
Returns the value of attribute tab_stops.
6 7 8 |
# File 'lib/htmlbeautifier/beautifier.rb', line 6 def tab_stops @tab_stops end |
Instance Method Details
#scan(html) ⇒ Object
Process an HTML/HTML+ERB document html should be a string
18 19 20 21 |
# File 'lib/htmlbeautifier/beautifier.rb', line 18 def scan(html) @parser = HtmlParser.new @parser.scan html.strip, Builder.new(@output, self.tab_stops) end |