Class: Less2Sass::Less::ASTHandler
- Inherits:
-
Object
- Object
- Less2Sass::Less::ASTHandler
- Defined in:
- lib/less2sass/less/ast_handler.rb
Overview
Handler of the Less AST.
Instance Method Summary collapse
-
#initialize(input, target_syntax) ⇒ ASTHandler
constructor
A new instance of ASTHandler.
-
#to_sass ⇒ Less2Sass::Sass::ASTHandler
Converts the transformed Less AST to Sass AST.
-
#transform_tree ⇒ Object
Transforms the Less AST, so it can be converted to an equivalent Sass AST representation.
Constructor Details
#initialize(input, target_syntax) ⇒ ASTHandler
Returns a new instance of ASTHandler.
10 11 12 13 14 15 16 |
# File 'lib/less2sass/less/ast_handler.rb', line 10 def initialize(input, target_syntax) @target_syntax = target_syntax parser = Parser.new(input) # TODO: check syntax only if specified in the command-line options # parser.check_syntax unless input == $stdin @tree = parser.parse end |
Instance Method Details
#to_sass ⇒ Less2Sass::Sass::ASTHandler
Converts the transformed Less AST to Sass AST.
28 29 30 |
# File 'lib/less2sass/less/ast_handler.rb', line 28 def to_sass Less2Sass::Sass::ASTHandler.new(@tree.to_sass(:syntax => @target_syntax)) end |
#transform_tree ⇒ Object
Transforms the Less AST, so it can be converted to an equivalent Sass AST representation.
20 21 22 23 |
# File 'lib/less2sass/less/ast_handler.rb', line 20 def transform_tree @tree.transform self end |