[ruby/prism] Share comment generation logic
https://github.com/ruby/prism/commit/6e5556dbdf
This commit is contained in:
parent
322755a007
commit
b0a2373e14
@ -32,8 +32,8 @@ module Prism
|
||||
end
|
||||
<%- nodes.each do |node| -%>
|
||||
|
||||
<%- node.comment.each_line do |line| -%>
|
||||
#<%= line.prepend(" ").rstrip %>
|
||||
<%- node.each_comment_line do |line| -%>
|
||||
#<%= line %>
|
||||
<%- end -%>
|
||||
class <%= node.name -%> < Node
|
||||
<%- node.fields.each do |field| -%>
|
||||
|
@ -255,6 +255,10 @@ module Prism
|
||||
@comment = config.fetch("comment")
|
||||
end
|
||||
|
||||
def each_comment_line
|
||||
comment.each_line { |line| yield line.prepend(" ").rstrip }
|
||||
end
|
||||
|
||||
def semantic_fields
|
||||
@semantic_fields ||= @fields.select(&:semantic_field?)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user