Class: Erbf
- Inherits:
-
Object
- Object
- Erbf
- Defined in:
- lib/erbf.rb,
lib/erbf/version.rb
Defined Under Namespace
Classes: CLI, Config, Formatter
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #format_ast(ast_node) ⇒ Object
- #format_code(input) ⇒ Object
-
#initialize(config_or_options = {}) ⇒ Erbf
constructor
A new instance of Erbf.
Constructor Details
Instance Method Details
#format_ast(ast_node) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/erbf.rb', line 26 def format_ast(ast_node) PrettierPrint.format(+"", @config.line_length) do |q| @logger.debug(to_s) { "AST:\n#{PP.pp(ast_node, +"", 80)}" } # TODO: Use Herb::Visitor Formatter.new(q, @config).visit(ast_node) @logger.debug(to_s) { "Formatted:\n#{PP.pp(q.target, +"", 80)}" } end end |
#format_code(input) ⇒ Object
20 21 22 23 24 |
# File 'lib/erbf.rb', line 20 def format_code(input) result = Herb.parse(input) # TODO: Handle errors format_ast(result.value) end |