Module: Jade::Frontend::CommentAttacher
- Extended by:
- CommentAttacher
- Included in:
- CommentAttacher
- Defined in:
- lib/jade/frontend/comment_attacher.rb
Defined Under Namespace
Modules: CommentEntry Classes: CommentGroup
Constant Summary collapse
- SKIP_FIELDS =
%i[range symbol id leading_comments trailing_comments dangling_comments].freeze
Instance Method Summary collapse
Instance Method Details
#attach(ast, comments, source) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/jade/frontend/comment_attacher.rb', line 8 def attach(ast, comments, source) return ast if comments.empty? collect_nodes(ast) .reject { |n| n.range.nil? } .sort_by { |n| n.range.begin } .then { build_map(comments, it, source) } .then { reattach(ast, it) } end |