Sha256: 2ea7cf77392204c9e48492dc4ee6789f4a3237373866ad44b457acd77edd4a08
Contents?: true
Size: 727 Bytes
Versions: 14
Compression:
Stored size: 727 Bytes
Contents
require 'reek/source/ast_node_class_map' module Reek module Source # # Adorns an abstract syntax tree with mix-in modules to make accessing # the tree more understandable and less implementation-dependent. # class TreeDresser def initialize(klass_map = AstNodeClassMap.new) @klass_map = klass_map end def dress(sexp, comment_map) return sexp unless sexp.is_a? AST::Node type = sexp.type children = sexp.children.map { |child| dress(child, comment_map) } comments = comment_map[sexp] @klass_map.klass_for(type).new(type, children, location: sexp.loc, comments: comments) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems